1
0
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:
Ross McFarland
2022-02-16 15:46:46 -08:00
parent 1b543c675f
commit 14fc137788
2 changed files with 19 additions and 17 deletions

View File

@@ -94,14 +94,15 @@ class BaseProvider(BaseSource):
record = record.copy()
record.values = [record.value]
desired.add_record(record, replace=True)
elif record._type == 'NS' and record.name == '' and \
not self.SUPPORTS_ROOT_NS:
# ignore, we can't manage root NS records
msg = \
f'root NS record not supported for {record.fqdn}'
fallback = 'ignoring it'
self.supports_warn_or_except(msg, fallback)
desired.remove_record(record)
record = desired.root_ns
if record and not self.SUPPORTS_ROOT_NS:
# ignore, we can't manage root NS records
msg = \
f'root NS record not supported for {record.fqdn}'
fallback = 'ignoring it'
self.supports_warn_or_except(msg, fallback)
desired.remove_record(record)
return desired
@@ -124,15 +125,14 @@ class BaseProvider(BaseSource):
provider configuration.
'''
for record in existing.records:
if record._type == 'NS' and record.name == '' and \
not self.SUPPORTS_ROOT_NS:
# ignore, we can't manage root NS records
msg = \
f'root NS record not supported for {record.fqdn}'
fallback = 'ignoring it'
self.supports_warn_or_except(msg, fallback)
existing.remove_record(record)
record = existing.root_ns
if record and not self.SUPPORTS_ROOT_NS:
# ignore, we can't manage root NS records
msg = \
f'root NS record not supported for {record.fqdn}'
fallback = 'ignoring it'
self.supports_warn_or_except(msg, fallback)
existing.remove_record(record)
return existing