Commit f84aeaee authored by Dmitry Galkin's avatar Dmitry Galkin

Keep NS records for subdomains during Zone import.

Change-Id: I07829822b8a50b0bff0b28370d9d6d3faacd445c
Closes-Bug: 1747016
parent c2e0b248
......@@ -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:
......
......@@ -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