From: Frank Brehm Date: Thu, 18 Jan 2018 13:43:12 +0000 (+0100) Subject: Rectifying SOA, NS and MX records during import X-Git-Tag: 0.1.2~12 X-Git-Url: https://git.uhu-banane.net/?a=commitdiff_plain;h=9480cca8f79705ca75293c7be382a5cfee09e708;p=pixelpark%2Fadmin-tools.git Rectifying SOA, NS and MX records during import --- diff --git a/pp_lib/import_pdnsdata.py b/pp_lib/import_pdnsdata.py index 8686c99..8e2ba92 100644 --- a/pp_lib/import_pdnsdata.py +++ b/pp_lib/import_pdnsdata.py @@ -36,7 +36,7 @@ from .cfg_app import PpCfgAppError, PpConfigApplication from .pdns_record import PdnsSoaData -__version__ = '0.9.2' +__version__ = '0.9.3' LOG = logging.getLogger(__name__) # ============================================================================= @@ -893,6 +893,15 @@ class ImportPdnsdataApp(PpConfigApplication): result['ordername'] = '' else: result['ordername'] = '' + if result['type'] in ('NS', 'MX'): + result['content'] = RE_DOT_AT_END.sub('', result['content']) + elif result['type'] == 'SOA': + soa = PdnsSoaData.init_from_data( + result['content'], appname=self.appname, + verbose=self.verbose, base_dir=self.base_dir) + soa.primary = RE_DOT_AT_END.sub('', soa.primary) + soa.email = RE_DOT_AT_END.sub('', soa.email) + result['content'] = soa.data if not self.simulate: tgt_cursor.execute(tgt_sql, result) LOG.info("Imported {} records.".format(i)) @@ -1424,7 +1433,7 @@ class ImportPdnsdataApp(PpConfigApplication): 'ns3.pp-dns.com.', 'ns4.pp-dns.com.', ) - mail_addr = 'hostmaster.pixelpark.net.' + mail_addr = 'hostmaster.pixelpark.net' LOG.info("Creating zone {z!r} for AS network {n!r} ...".format( z=zone_name, n=net_addr)) @@ -1470,7 +1479,7 @@ class ImportPdnsdataApp(PpConfigApplication): "Did not found Domain Id of zone {!r}.".format(zone_name)) LOG.info("Using Id of zone {z!r}: {i}.".format(z=zone_name, i=domain_id)) - ns_used = RE_DOT_AT_END.sub('.', nameservers[0]) + ns_used = RE_DOT_AT_END.sub('', nameservers[0]) soa = PdnsSoaData( primary=ns_used, email=mail_addr, serial=serial, refresh=refresh, retry=retry, expire=expire, ttl=ttl,