1
0
mirror of https://github.com/github/octodns.git synced 2024-05-11 05:55:00 +00:00

Copy zones early on and allow modifications after that. Doc requirements.

This commit is contained in:
Ross McFarland
2021-08-21 13:41:10 -07:00
parent fe013b21e3
commit b84b933eb0
8 changed files with 92 additions and 53 deletions

View File

@@ -32,9 +32,8 @@ class AcmeMangingProcessor(BaseProcessor):
self._owned = set()
def process_source_zone(self, zone, *args, **kwargs):
ret = zone.copy()
for record in zone.records:
def process_source_zone(self, desired, *args, **kwargs):
for record in desired.records:
if record._type == 'TXT' and \
record.name.startswith('_acme-challenge'):
# We have a managed acme challenge record (owned by octoDNS) so
@@ -45,12 +44,11 @@ class AcmeMangingProcessor(BaseProcessor):
# This assumes we'll see things as sources before targets,
# which is the case...
self._owned.add(record)
ret.add_record(record, replace=True)
return ret
desired.add_record(record, replace=True)
return desired
def process_target_zone(self, zone, *args, **kwargs):
ret = zone.copy()
for record in zone.records:
def process_target_zone(self, existing, *args, **kwargs):
for record in existing.records:
# Uses a startswith rather than == to ignore subdomain challenges,
# e.g. _acme-challenge.foo.domain.com when managing domain.com
if record._type == 'TXT' and \
@@ -58,6 +56,6 @@ class AcmeMangingProcessor(BaseProcessor):
'*octoDNS*' not in record.values and \
record not in self._owned:
self.log.info('_process: ignoring %s', record.fqdn)
ret.remove_record(record)
existing.remove_record(record)
return ret
return existing