]> Frank Brehm's Git Trees - pixelpark/admin-tools.git/commitdiff
Renaming method is_local() to is_local_domain()
authorFrank Brehm <frank.brehm@pixelpark.com>
Wed, 17 Jan 2018 14:54:31 +0000 (15:54 +0100)
committerFrank Brehm <frank.brehm@pixelpark.com>
Wed, 17 Jan 2018 14:54:31 +0000 (15:54 +0100)
* renamin in classes ImportPdnsdataApp and PDNSMigrateNsApp
* Removing comment on migration in PDNSMigrateNsApp

pp_lib/import_pdnsdata.py
pp_lib/pdns_app.py
pp_lib/pdns_migrate_ns.py

index aa63e31ca4994540977939193a1194a1e20bb08a..2d44ebf2df4dabfce556769aed320674eef90ccb 100644 (file)
@@ -31,7 +31,7 @@ from .common import pp, to_bool
 
 from .cfg_app import PpCfgAppError, PpConfigApplication
 
-__version__ = '0.8.8'
+__version__ = '0.8.9'
 LOG = logging.getLogger(__name__)
 
 # =============================================================================
@@ -639,7 +639,7 @@ class ImportPdnsdataApp(PpConfigApplication):
                     i += 1
                     dom_id = result['id']
                     self.domain_ids[dom_id] = result['name']
-                    if self.is_local(result['name']):
+                    if self.is_local_domain(result['name']):
                         LOG.debug("Setting zone {!r} to a local only zone.".format(result['name']))
                         cur_account = result['account']
                         if cur_account is None:
index 38e5fce97489a05cf1b7c8b28483ac715c80b784..fa54c2be0897180116fd1c3a694d61d1bf09cb3d 100644 (file)
@@ -32,7 +32,7 @@ from .cfg_app import PpCfgAppError, PpConfigApplication
 from .pdns_zone import PdnsApiZone
 from .pdns_record import PdnsApiRecord, PdnsSoaData, PdnsApiRrset
 
-__version__ = '0.6.2'
+__version__ = '0.6.3'
 LOG = logging.getLogger(__name__)
 _LIBRARY_NAME = "pp-pdns-api-client"
 
@@ -749,9 +749,16 @@ class PpPDNSApplication(PpConfigApplication):
         ns_ttl = None
         if not new_ttl:
             cur_rrset = zone.get_ns_rrset(for_zone=for_zone)
-            ns_ttl = cur_rrset.ttl
+            if cur_rrset:
+                ns_ttl = cur_rrset.ttl
+            else:
+                soa = zone.get_soa()
+                ns_ttl = soa.ttl
+                del soa
         else:
             ns_ttl = int(new_ttl)
+        if ns_ttl <= 0:
+            ns_ttl = 3600
         LOG.debug("TTL for NS records: {}.".format(ns_ttl))
 
         rrset_name = zone.name.lower()
index 5735b812525d735299a0650f4d7b24e2f790208d..d36726282abcde25d283f6fd35da192442fad29b 100644 (file)
@@ -27,7 +27,7 @@ from .pdns_app import PpPDNSAppError, PpPDNSApplication, PDNSApiNotFoundError, P
 from .pdns_zone import PdnsApiZone
 from .pdns_record import compare_rrsets
 
-__version__ = '0.2.6'
+__version__ = '0.2.7'
 LOG = logging.getLogger(__name__)
 
 
@@ -157,7 +157,7 @@ class PDNSMigrateNsApp(PpPDNSApplication):
         new_nameservers = []
         hm_address = self.address_hostmaster_public
 
-        is_local = self.is_local(zone_name)
+        is_local = self.is_local_domain(zone_name)
 
         if is_local:
             LOG.debug("Using local nameservers for substituting.")
@@ -189,8 +189,7 @@ class PDNSMigrateNsApp(PpPDNSApplication):
             LOG.debug("Update SOA of zone is not necessary.".format(zone_name))
 
         LOG.info("Setting nameservers for zone {!r} ...".format(zone_name))
-        comment = "Update NS entries on great NS- and SOA-Migration."
-        if not self.set_nameservers(zone, new_nameservers, comment=comment, do_serial=False):
+        if not self.set_nameservers(zone, new_nameservers, do_serial=False):
             return False
 
         zone_parts = zone_name.split('.')
@@ -208,7 +207,7 @@ class PDNSMigrateNsApp(PpPDNSApplication):
                 z=zone_name, t=top_zone_name))
             top_zone = self.get_api_zone(top_zone_name)
             return self.set_nameservers(
-                top_zone, new_nameservers, zone_name, comment=comment, do_serial=False)
+                top_zone, new_nameservers, zone_name, do_serial=False)
         else:
             LOG.debug("Top zone {!r} is not in our responsibility.".format(top_zone_name))
         return True