def checkUnicity(self, new_resource, loader_context=None): if isinstance(new_resource, HostnameResource) and new_resource.hostname == self.hostname: message = tr('The "%s" hostname (%s) already exists: hostname "%s"!') args = (new_resource.hostname, new_resource.formatID(), self.formatID()) if loader_context is not None: loader_context.warning(message, args) else: raise RulesetError(message, *args) Resource.checkUnicity(self, new_resource, loader_context)
def checkUnicity(self, new_resource, loader_context=None): Resource.checkUnicity(self, new_resource, loader_context) if self.hasAddresses() \ and new_resource.hasAddresses() \ and self.address in new_resource.getAddresses(): message = tr('The "%s" address (%s) already exists: network %s!') args = (unicode(new_resource.address), new_resource.formatID(), self.formatID()) if loader_context is not None: loader_context.warning(message, args) else: raise RulesetError(message, *args)