MCPcopy Create free account
hub / github.com/apache/cloudstack / compare

Method compare

systemvm/debian/opt/cloud/bin/cs/CsAddress.py:942–967  ·  view source on GitHub ↗
(self, bag)

Source from the content-addressed store, hash-verified

940
941 # Delete any ips that are configured but not in the bag
942 def compare(self, bag):
943 if len(self.iplist) > 0 and (self.dev not in list(bag.keys()) or len(bag[self.dev]) == 0):
944 # Remove all IPs on this device
945 logging.info(
946 "Will remove all configured addresses on device %s", self.dev)
947 self.delete("all")
948 app = CsApache(self)
949 app.remove()
950
951 # This condition should not really happen but did :)
952 # It means an apache file got orphaned after a guest network address
953 # was deleted
954 if len(self.iplist) == 0 and (self.dev not in list(bag.keys()) or len(bag[self.dev]) == 0):
955 app = CsApache(self)
956 app.remove()
957
958 for ip in self.iplist:
959 found = False
960 if self.dev in list(bag.keys()):
961 for address in bag[self.dev]:
962 self.setAddress(address)
963 if (self.hasIP(ip) or self.is_guest_gateway(address, ip)) and address["add"]:
964 logging.debug("The IP address in '%s' will be configured" % address)
965 found = True
966 if not found:
967 self.delete(ip)
968
969 def get_gateway(self):
970 interface = CsInterface(self.address, self.config)

Callers 1

compareMethod · 0.95

Calls 9

deleteMethod · 0.95
removeMethod · 0.95
setAddressMethod · 0.95
hasIPMethod · 0.95
is_guest_gatewayMethod · 0.95
CsApacheClass · 0.85
keysMethod · 0.80
debugMethod · 0.80
infoMethod · 0.45

Tested by

no test coverage detected