From 6174e034c188c34171c87b410e4373efeb68a0e7 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Mon, 29 Nov 2021 14:15:34 +0100 Subject: [PATCH] Fixing lib/pp_admintools/deploy_zones_from_pdns.py --- lib/pp_admintools/deploy_zones_from_pdns.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/pp_admintools/deploy_zones_from_pdns.py b/lib/pp_admintools/deploy_zones_from_pdns.py index 2b0786b..a3eeead 100644 --- a/lib/pp_admintools/deploy_zones_from_pdns.py +++ b/lib/pp_admintools/deploy_zones_from_pdns.py @@ -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: -- 2.39.5