]> Frank Brehm's Git Trees - pixelpark/pp-admin-tools.git/commitdiff
Collecting server configuration
authorFrank Brehm <frank@brehm-online.com>
Tue, 7 Dec 2021 16:19:06 +0000 (17:19 +0100)
committerFrank Brehm <frank@brehm-online.com>
Tue, 7 Dec 2021 16:19:06 +0000 (17:19 +0100)
lib/pp_admintools/deploy_zones_from_pdns.py

index c1e0afa62647fd00ba2ca82586f5f1547df9affa..bd973e6b790194b0999162f871f6a53fe3ce1fab 100644 (file)
@@ -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'