Merge "Keep NS records for subdomains during Zone import."

This commit is contained in:
Zuul 2018-03-05 04:04:40 +00:00 committed by Gerrit Code Review
commit dd611a025e
2 changed files with 5 additions and 3 deletions

View File

@ -2680,7 +2680,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