Commit dd611a02 authored by Zuul's avatar Zuul Committed by Gerrit Code Review

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

parents ebe8c1f6 f84aeaee
......@@ -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:
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment