From: Frank Brehm Date: Tue, 7 Dec 2021 16:19:06 +0000 (+0100) Subject: Collecting server configuration X-Git-Tag: 0.4.1~5^2~3 X-Git-Url: https://git.uhu-banane.org/?a=commitdiff_plain;h=d5950d329c2ddf083ac4ab74244a1fa14d40dcd3;p=pixelpark%2Fpp-admin-tools.git Collecting server configuration --- diff --git a/lib/pp_admintools/deploy_zones_from_pdns.py b/lib/pp_admintools/deploy_zones_from_pdns.py index c1e0afa..bd973e6 100644 --- a/lib/pp_admintools/deploy_zones_from_pdns.py +++ b/lib/pp_admintools/deploy_zones_from_pdns.py @@ -136,6 +136,7 @@ class PpDeployZonesApp(PpPDNSApplication): self.cmd_restart = self.default_cmd_restart self.named_keys = {} + self.servers = {} self.zone_tsig_key = None @@ -396,6 +397,10 @@ class PpDeployZonesApp(PpPDNSApplication): self.init_temp_objects() self.generate_slave_cfg_file() + if self.servers: + self.debug(_("Collected server configuration:") + '\n' + pp(self.servers)) + else: + self.debug(_("Collected server configuration:") + ' ' + _('None')) self.compare_files() try: @@ -609,10 +614,18 @@ class PpDeployZonesApp(PpPDNSApplication): allow_line = '\tallow-transfer {' for key_id in zone.master_tsig_key_ids: - allow_line += 'key "{}";'.format(key_id) + allow_line += ' key "{}";'.format(key_id) allow_line += ' };' lines.append(allow_line) + for master in self.zone_masters: + if master not in self.servers: + self.servers[master] = {} + if 'keys' not in self.servers[master]: + self.servers[master]['keys'] = set() + for key_id in zone.master_tsig_key_ids: + self.servers[master]['keys'].add(key_id) + lines.append('};') return '\n'.join(lines) + '\n'