from .obj import PpBaseObjectError, PpBaseObject
from .pdns_record import PdnsApiRrset, PdnsSoaData
-__version__ = '0.4.4'
+__version__ = '0.4.5'
LOG = logging.getLogger(__name__)
return tpl.format(**params)
+ # -------------------------------------------------------------------------
+ def get_soa_rrset(self):
+
+ for rrset in self.rrsets:
+ if rrset.type == 'SOA':
+ return rrset
+ return None
+
+ # -------------------------------------------------------------------------
+ def get_soa_record(self):
+
+ rrset = self.get_soa_rrset()
+ if self.verbose > 3:
+ LOG.debug("Got SOA RRset:\n{}".format(rrset))
+ if not rrset:
+ return None
+ if not rrset.records:
+ return None
+ return rrset.records[0]
+
# -------------------------------------------------------------------------
def get_soa(self):
soa = None
+ record = self.get_soa_record()
+ if self.verbose > 3:
+ LOG.debug("Got SOA record:\n{}".format(record))
+ if not record:
+ return None
- for rrset in self.rrsets:
- if rrset.type == 'SOA':
- for record in rrset.records:
- soa = PdnsSoaData.init_from_data(
- data=record.content, appname=self.appname,
- verbose=self.verbose, base_dir=self.base_dir)
- break
- if soa:
- break
+ soa = PdnsSoaData.init_from_data(
+ data=record.content, appname=self.appname,
+ verbose=self.verbose, base_dir=self.base_dir)
return soa