Keep NS records for subdomains during Zone import.

Change-Id: I07829822b8a50b0bff0b28370d9d6d3faacd445c
Closes-Bug: 1747016
This commit is contained in:
Dmitry Galkin 2018-02-21 17:06:50 +00:00
parent c2e0b2481a
commit f84aeaeefe
2 changed files with 5 additions and 3 deletions

View File

@ -2674,7 +2674,10 @@ class Service(service.RPCService, service.Service):
zone.type = 'PRIMARY'
for rrset in list(zone.recordsets):
if rrset.type in ('NS', 'SOA'):
if rrset.type == 'SOA':
zone.recordsets.remove(rrset)
# subdomain NS records should be kept
elif rrset.type == 'NS' and rrset.name == zone.name:
zone.recordsets.remove(rrset)
except dnszone.UnknownOrigin:

View File

@ -130,10 +130,9 @@ class APIV2ZoneImportExportTest(ApiV2TestCase):
# and dnspython considers that to be not equal.
imported.delete_rdataset(imported.origin, 'SOA')
exported.delete_rdataset(exported.origin, 'SOA')
# Delete NS records, since they won't be the same
# Delete NS records, except for delegated subdomains
imported.delete_rdataset(imported.origin, 'NS')
exported.delete_rdataset(exported.origin, 'NS')
imported.delete_rdataset('delegation', 'NS')
self.assertEqual(imported, exported)
# Metadata tests