import logging.config
import textwrap
import copy
+import socket
from functools import cmp_to_key
from .pdns_zone import PdnsApiZone
from .pdns_record import compare_rrsets
-__version__ = '0.2.4'
+__version__ = '0.2.5'
LOG = logging.getLogger(__name__)
if not zone:
return False
+ api_host_address = None
+ for addr_info in socket.getaddrinfo(self.api_host, 53, family=socket.AF_INET):
+ api_host_address = addr_info[4][0]
+ break
+
new_nameservers = []
hm_address = self.address_hostmaster_public
else:
LOG.debug("Update SOA of zone is not necessary.".format(zone_name))
+ dns_soa = zone.get_soa_by_dns(api_host_address)
+ LOG.debug("Got SOA from DNS by {h!r}:\n{s}".format(h=self.api_host, s=dns_soa))
+
if not self.ensure_nameservers(zone, new_nameservers):
return False
+ new_serial = zone.get_new_serial(dns_soa.serial)
+ LOG.debug("Got new serial number for zone {z!r}: {s}.".format(
+ z=zone_name, s=new_serial))
+
zone_parts = zone_name.split('.')
top_zone_name = '.'.join(zone_parts[1:])
LOG.debug("Top zone of {z!r} is {t!r}.".format(z=zone_name, t=top_zone_name))