diff --git a/README.md b/README.md index 4770d16..43895ec 100644 --- a/README.md +++ b/README.md @@ -115,7 +115,11 @@ zone.create_records([ powerdns.RRSet('a', 'A', [('1.1.1.1', False)], comments=comments), powerdns.RRSet('b', 'A', ['1.1.1.2', '1.1.1.3']), powerdns.RRSet('c', 'A', [('1.1.1.4', False)]), - powerdns.RRSet('d', 'CNAME', ['a']) + powerdns.RRSet('d', 'CNAME', ['a']), + # Added TXT record for "test.python-powerdns.domain.tld." + powerdns.RRSet('','TXT', [('"v=spf1 mx include:spf.domain.tld ~all"', False)]), + # Added MX record for "test.python-powerdns.domain.tld." + powerdns.RRSet('','MX', [('10 mx.domain.tld.', False)]) ]) zone.delete_records([ diff --git a/powerdns/interface.py b/powerdns/interface.py index 2c98c77..be11a4e 100644 --- a/powerdns/interface.py +++ b/powerdns/interface.py @@ -537,6 +537,10 @@ def ensure_canonical(self, zone): LOG.debug("ensuring rrset %s is canonical", self['name']) if not zone.endswith('.'): raise PDNSCanonicalError(zone) + # Allowed add TXT and MX record, because record string must be empty + if not self['name']: + LOG.debug("transforming %s with %s", self['name'], zone) + self['name'] += "%s" % zone if not self['name'].endswith('.'): LOG.debug("transforming %s with %s", self['name'], zone) self['name'] += ".%s" % zone