from .obj import PpBaseObjectError, PpBaseObject
from .pdns_record import PdnsApiRrset, PdnsSoaData
-__version__ = '0.5.1'
+__version__ = '0.5.2'
LOG = logging.getLogger(__name__)
return new_serial
# -------------------------------------------------------------------------
- def get_zone_nameservers(self, for_zone=None):
-
- nameservers = []
+ def get_ns_rrset(self, for_zone=None):
for rrset in self.rrsets:
if rrset.type == 'NS':
else:
if self.name.lower() != rrset.name.lower():
continue
- for record in rrset.records:
- ns = RE_DOT_AT_END.sub('.', record.content).lower()
- nameservers.append(ns)
+ return rrset
+ return None
+
+ # -------------------------------------------------------------------------
+ def get_ns_records(self, for_zone=None):
+
+ rrset = self.get_ns_rrset(for_zone=for_zone)
+ if self.verbose > 2:
+ LOG.debug("Got NS RRset:\n{}".format(rrset))
+ if not rrset:
+ return None
+ if not rrset.records:
+ return None
+
+ ns_records = []
+ for record in rrset.records:
+ ns_records.append(record)
+ return ns_records
+
+ # -------------------------------------------------------------------------
+ def get_zone_nameservers(self, for_zone=None):
+
+ nameservers = []
+ ns_records = self.get_ns_records(for_zone=for_zone)
+ if not ns_records:
+ return nameservers
+
+ for record in ns_records:
+ ns = RE_DOT_AT_END.sub('.', record.content).lower()
+ nameservers.append(ns)
nameservers.sort()
return nameservers
+
# =============================================================================
if __name__ == "__main__":