mirror of
https://github.com/github/octodns.git
synced 2024-05-11 05:55:00 +00:00
Use Zone.root_ns to avoid lookping/searching
This commit is contained in:
@@ -94,14 +94,15 @@ class BaseProvider(BaseSource):
|
|||||||
record = record.copy()
|
record = record.copy()
|
||||||
record.values = [record.value]
|
record.values = [record.value]
|
||||||
desired.add_record(record, replace=True)
|
desired.add_record(record, replace=True)
|
||||||
elif record._type == 'NS' and record.name == '' and \
|
|
||||||
not self.SUPPORTS_ROOT_NS:
|
record = desired.root_ns
|
||||||
# ignore, we can't manage root NS records
|
if record and not self.SUPPORTS_ROOT_NS:
|
||||||
msg = \
|
# ignore, we can't manage root NS records
|
||||||
f'root NS record not supported for {record.fqdn}'
|
msg = \
|
||||||
fallback = 'ignoring it'
|
f'root NS record not supported for {record.fqdn}'
|
||||||
self.supports_warn_or_except(msg, fallback)
|
fallback = 'ignoring it'
|
||||||
desired.remove_record(record)
|
self.supports_warn_or_except(msg, fallback)
|
||||||
|
desired.remove_record(record)
|
||||||
|
|
||||||
return desired
|
return desired
|
||||||
|
|
||||||
@@ -124,15 +125,14 @@ class BaseProvider(BaseSource):
|
|||||||
provider configuration.
|
provider configuration.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
for record in existing.records:
|
record = existing.root_ns
|
||||||
if record._type == 'NS' and record.name == '' and \
|
if record and not self.SUPPORTS_ROOT_NS:
|
||||||
not self.SUPPORTS_ROOT_NS:
|
# ignore, we can't manage root NS records
|
||||||
# ignore, we can't manage root NS records
|
msg = \
|
||||||
msg = \
|
f'root NS record not supported for {record.fqdn}'
|
||||||
f'root NS record not supported for {record.fqdn}'
|
fallback = 'ignoring it'
|
||||||
fallback = 'ignoring it'
|
self.supports_warn_or_except(msg, fallback)
|
||||||
self.supports_warn_or_except(msg, fallback)
|
existing.remove_record(record)
|
||||||
existing.remove_record(record)
|
|
||||||
|
|
||||||
return existing
|
return existing
|
||||||
|
|
||||||
|
@@ -216,6 +216,8 @@ class TestManager(TestCase):
|
|||||||
with open(join(tmpdir.dirname, 'unit.tests.yaml'), 'w') as fh:
|
with open(join(tmpdir.dirname, 'unit.tests.yaml'), 'w') as fh:
|
||||||
fh.write('---\n{}')
|
fh.write('---\n{}')
|
||||||
|
|
||||||
|
# compare doesn't use _process_desired_zone and thus doesn't filter
|
||||||
|
# out root NS records, that seems fine/desirable
|
||||||
changes = manager.compare(['in'], ['dump'], 'unit.tests.')
|
changes = manager.compare(['in'], ['dump'], 'unit.tests.')
|
||||||
self.assertEqual(21, len(changes))
|
self.assertEqual(21, len(changes))
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user