From: Frank Brehm Date: Mon, 11 Dec 2017 18:04:21 +0000 (+0100) Subject: Finishing configuration of zone masters X-Git-Tag: 0.1.2~64 X-Git-Url: https://git.uhu-banane.net/?a=commitdiff_plain;h=a12aa139f5d9c7cdfc8abdc67b6b79bffc4ed340;p=pixelpark%2Fadmin-tools.git Finishing configuration of zone masters --- diff --git a/pp_lib/deploy_zones_from_pdns.py b/pp_lib/deploy_zones_from_pdns.py index 84557f5..afba2ef 100644 --- a/pp_lib/deploy_zones_from_pdns.py +++ b/pp_lib/deploy_zones_from_pdns.py @@ -44,7 +44,7 @@ from .pdns_record import compare_rrsets from .pidfile import PidFileError, InvalidPidFileError, PidFileInUseError, PidFile -__version__ = '0.5.1' +__version__ = '0.5.2' LOG = logging.getLogger(__name__) @@ -268,14 +268,22 @@ class PpDeployZonesApp(PpPDNSApplication): for m in self.re_split_addresses.split(value): if m: m = m.strip().lower() + LOG.debug("Checking given master address {!r} ...".format(m)) try: addr_infos = socket.getaddrinfo( m, 53, proto=socket.IPPROTO_TCP) for addr_info in addr_infos: + addr = addr_info[4][0] if not self.named_listen_on_v6 and addr_info[0] == socket.AF_INET6: + msg = ( + "Not using {!r} as a master IP address, because " + "we are not using IPv6.").format(addr) + LOG.debug(msg) continue - addr = addr_info[4][0] - if addr not in masters and addr not in self.local_addresses: + if addr in masters: + LOG.debug("Address {!r} already in masters yet.".format(addr)) + else: + LOG.debug("Address {!r} not in masters yet.".format(addr)) masters.append(addr) except socket.gaierror as e: @@ -301,6 +309,19 @@ class PpDeployZonesApp(PpPDNSApplication): LOG.debug("Post init phase.") + LOG.debug("Checking for masters, which are local addresses ...") + ext_masters = [] + for addr in self.zone_masters: + if addr in self.local_addresses: + LOG.debug( + "Address {!r} IS in list of local addresses.".format(addr)) + else: + LOG.debug( + "Address {!r} not in list of local addresses.".format(addr)) + ext_masters.append(addr) + self.zone_masters = ext_masters + LOG.info("Using list of masters for slave zones:\n{}".format(pp(self.zone_masters))) + self.pidfile = PidFile( filename=self.pidfile_name, appname=self.appname, verbose=self.verbose, base_dir=self.base_dir, simulate=self.simulate)