self.default_ttl = ttl
# -------------------------------------------------------------------------
- def show_zone(self, zone):
+ def show_zone(self, zone_name):
- zone_unicode = zone
+ zone_unicode = zone_name
json_response = None
- zout = "{!r}".format(zone)
- if 'xn--' in zone:
- zone_unicode = zone.encode('idna').decode('idna')
- zout = "{!r} ({})".format(zone, zone_unicode)
+ zout = "{!r}".format(zone_name)
+ if 'xn--' in zone_name:
+ zone_unicode = zone_name.encode('idna').decode('idna')
+ zout = "{!r} ({})".format(zone_name, zone_unicode)
LOG.info("Show all information about zone {} from PowerDNS environment {!r}.".format(
zout, self.environment))
- path = "/servers/{}/zones/{}".format(self.api_servername, zone)
+ path = "/servers/{}/zones/{}".format(self.api_servername, zone_name)
try:
json_response = self.perform_request(path)
except (PDNSApiNotFoundError, PDNSApiValidationError) as e:
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())))
+
return True
# =============================================================================
from .errors import PpError
from .obj import PpBaseObjectError, PpBaseObject
-__version__ = '0.2.1'
+__version__ = '0.3.1'
LOG = logging.getLogger(__name__)
def __init__(
self, appname=None, verbose=0, version=__version__, base_dir=None, initialized=None,
account=None, dnssec=False, id=None, kind=None, last_check=None,
- masters=None, name=None, notified_serial=None, serial=None, url=None):
+ masters=None, name=None, notified_serial=None, serial=None, url=None,
+ rrsets=None, soa_edit=None, soa_edit_api=None):
# { 'account': 'local',
# 'dnssec': False,
self._url = url
self.records = []
+ self._soa_edit = soa_edit
+ self._soa_edit_api = soa_edit_api
super(PdnsApiZone, self).__init__(
appname=appname, verbose=verbose, version=version, base_dir=base_dir)
"""The URL in the API to get the zone object."""
return getattr(self, '_url', None)
+ # -----------------------------------------------------------
+ @property
+ def soa_edit(self):
+ """The SOA edit property of the zone object."""
+ return getattr(self, '_soa_edit', None)
+
+ # -----------------------------------------------------------
+ @property
+ def soa_edit_api(self):
+ """The SOA edit property (API) of the zone object."""
+ return getattr(self, '_soa_edit_api', None)
+
# -------------------------------------------------------------------------
def as_dict(self, short=True):
"""
res['serial'] = self.serial
res['url'] = self.url
res['records'] = copy.copy(self.records)
+ res['soa_edit'] = self.soa_edit
+ res['soa_edit_api'] = self.soa_edit_api
return res