From 663949f693150b236a600031a8a14396943e7509 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Fri, 12 Jan 2018 15:46:06 +0100 Subject: [PATCH] Using method get_api_zone() --- pp_lib/pdns_show_zone.py | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/pp_lib/pdns_show_zone.py b/pp_lib/pdns_show_zone.py index 5e1f681..4d3f62d 100644 --- a/pp_lib/pdns_show_zone.py +++ b/pp_lib/pdns_show_zone.py @@ -24,7 +24,7 @@ from .pdns_app import PpPDNSAppError, PpPDNSApplication, PDNSApiNotFoundError, P from .pdns_zone import PdnsApiZone from .pdns_record import compare_rrsets -__version__ = '0.4.1' +__version__ = '0.4.2' LOG = logging.getLogger(__name__) @@ -132,20 +132,7 @@ class PpPDNSShowZoneApp(PpPDNSApplication): LOG.info("Show all information about zone {} from PowerDNS environment {!r}.".format( zout, self.environment)) - - path = "/servers/{}/zones/{}".format(self.api_servername, zone_name) - try: - json_response = self.perform_request(path) - except (PDNSApiNotFoundError, PDNSApiValidationError) as e: - LOG.error("The given zone {} was not found.".format(zout)) - return False - if self.verbose > 2: - LOG.debug("Got a response:\n{}".format(pp(json_response))) - - zone = PdnsApiZone.init_from_dict( - json_response, appname=self.appname, verbose=self.verbose, base_dir=self. base_dir) - if self.verbose > 2: - LOG.debug("Zone object:\n{}".format(pp(zone.as_dict()))) + zone = self.get_api_zone(zone_name) msg = "All information about zone {}:".format(zout) print("\n{}".format(msg)) -- 2.39.5