Пример #1
0
 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
     result = compare_complex_list(self.want.virtual_server_dependencies, self.have.virtual_server_dependencies)
     return result
Пример #2
0
 def interfaces(self):
     if self.want.interfaces is None:
         return None
     if self.have.interfaces is None and self.want.interfaces in ['', 'none']:
         return None
     if self.have.interfaces is not None and self.want.interfaces in ['', 'none']:
         return []
     if self.have.interfaces is None:
         return dict(
             interfaces=self.want.interfaces
         )
     return compare_complex_list(self.want.interfaces, self.have.interfaces)
Пример #3
0
 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_complex_list(self.want.records, self.have.records)
     return result
Пример #4
0
    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_complex_list(self.want.rules, self.have.rules):
            return self.want.rules