]> Frank Brehm's Git Trees - pixelpark/pp-admin-tools.git/commitdiff
Fixing lib/pp_admintools/deploy_zones_from_pdns.py
authorFrank Brehm <frank@brehm-online.com>
Mon, 29 Nov 2021 13:15:34 +0000 (14:15 +0100)
committerFrank Brehm <frank@brehm-online.com>
Mon, 29 Nov 2021 13:15:34 +0000 (14:15 +0100)
lib/pp_admintools/deploy_zones_from_pdns.py

index 2b0786b1bff2ec05022d3c7c7c058b9c00d2881c..a3eeead228df5b3c31a8cb12742aacd77e2e0bf5 100644 (file)
@@ -24,14 +24,12 @@ import pipes
 
 from subprocess import Popen, TimeoutExpired, PIPE
 
-from functools import cmp_to_key
-
 # Third party modules
 import six
 from pytz import timezone, UnknownTimeZoneError
 
 # Own modules
-from fb_tools.common import pp, compare_fqdn, to_str, to_bool
+from fb_tools.common import pp, to_str, to_bool
 
 from .pdns_app import PpPDNSAppError, PpPDNSApplication
 
@@ -39,7 +37,7 @@ from .pidfile import PidFileError, PidFile
 
 from .xlate import XLATOR
 
-__version__ = '0.6.1'
+__version__ = '0.6.2'
 LOG = logging.getLogger(__name__)
 
 _ = XLATOR.gettext
@@ -97,7 +95,7 @@ class PpDeployZonesApp(PpPDNSApplication):
     # -------------------------------------------------------------------------
     def __init__(self, appname=None, base_dir=None, version=__version__):
 
-        self.zones = []
+        self.zones = {}
         self.pidfile = None
 
         self._show_simulate_opt = True
@@ -377,7 +375,6 @@ class PpDeployZonesApp(PpPDNSApplication):
                 datetime.datetime.now(local_tz).strftime('%Y-%m-%d %H:%M:%S %Z')))
 
             self.zones = self.get_api_zones()
-            self.zones.sort(key=lambda x: cmp_to_key(compare_fqdn)(x.name_unicode))
 
             self.init_temp_objects()
             self.generate_slave_cfg_file()
@@ -468,8 +465,9 @@ class PpDeployZonesApp(PpPDNSApplication):
 
         content = header
 
-        for zone in self.zones:
+        for zone_name in self.zones.keys():
 
+            zone = self.zones[zone_name]
             canonical_name = zone.name_unicode
             match = self.re_ipv4_zone.search(zone.name)
             if match: