def variables(self): if self.want.variables is None: return None if self.have.variables is None: return dict( variables=self.want.variables ) result = dict() different = compare_dictionary([self.want.variables], [self.have.variables]) if not different: return None for k, v in iteritems(self.want.variables): if k in self.have.variables and v != self.have.variables[k]: result[k] = v elif k not in self.have.variables: result[k] = v for k, v in iteritems(self.have.variables): if k not in self.want.variables: result[k] = "none" if result: result = dict( variables=result ) return result
def virtual_server_dependencies(self): if self.have.virtual_server_dependencies is None: return self.want.virtual_server_dependencies if self.want.virtual_server_dependencies is None and self.have.virtual_server_dependencies is None: return None if self.want.virtual_server_dependencies is None: return None return compare_dictionary(self.want.virtual_server_dependencies, self.have.virtual_server_dependencies)
def virtual_server_dependencies(self): if self.have.virtual_server_dependencies is None: return self.want.virtual_server_dependencies if self.want.virtual_server_dependencies is None and self.have.virtual_server_dependencies is None: return None if self.want.virtual_server_dependencies is None: return None return compare_dictionary(self.want.virtual_server_dependencies, self.have.virtual_server_dependencies)
def records(self): # External data groups are compared by their checksum, not their records. This # is because the BIG-IP does not store the actual records in the API. It instead # stores the checksum of the file. External DGs have the possibility of being huge # and we would never want to do a comparison of such huge files. # # Therefore, comparison is no-op if the DG being worked with is an external DG. if self.want.internal is False: return None if self.have.records is None and self.want.records == []: return None if self.have.records is None: return self.want.records result = compare_dictionary(self.want.records, self.have.records) return result
def records(self): # External data groups are compared by their checksum, not their records. This # is because the BIG-IP does not store the actual records in the API. It instead # stores the checksum of the file. External DGs have the possibility of being huge # and we would never want to do a comparison of such huge files. # # Therefore, comparison is no-op if the DG being worked with is an external DG. if self.want.internal is False: return None if self.have.records is None and self.want.records == []: return None if self.have.records is None: return self.want.records result = compare_dictionary(self.want.records, self.have.records) return result
def rules(self): if self.want.rules is None: return None if self.have.rules is None and self.want.rules == '': return None if self.have.rules is not None and self.want.rules == '': return [] if self.have.rules is None: return self.want.rules want = [tuple(x.pop('destination_ports')) for x in self.want.rules if 'destination_ports' in x] have = [tuple(x.pop('destination_ports')) for x in self.have.rules if 'destination_ports' in x] if set(want) != set(have): return self.want.rules if compare_dictionary(self.want.rules, self.have.rules): return self.want.rules
def rules(self): if self.want.rules is None: return None if self.have.rules is None and self.want.rules == '': return None if self.have.rules is not None and self.want.rules == '': return [] if self.have.rules is None: return self.want.rules want = [ tuple(x.pop('destination_ports')) for x in self.want.rules if 'destination_ports' in x ] have = [ tuple(x.pop('destination_ports')) for x in self.have.rules if 'destination_ports' in x ] if set(want) != set(have): return self.want.rules if compare_dictionary(self.want.rules, self.have.rules): return self.want.rules