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

Merge branch 'main' into rc-version-fix

This commit is contained in:
Ross McFarland
2023-06-20 09:23:38 -07:00
committed by GitHub
22 changed files with 112 additions and 49 deletions

View File

@@ -475,7 +475,6 @@ class Manager(object):
force=False,
plan_output_fh=stdout,
):
self.log.info(
'sync: eligible_zones=%s, eligible_targets=%s, dry_run=%s, '
'force=%s, plan_output_fh=%s',

View File

@@ -61,8 +61,13 @@ class AutoArpa(BaseProcessor):
zone,
name,
{'ttl': self.ttl, 'type': 'PTR', 'values': fqdns},
lenient=lenient,
)
zone.add_record(
record,
replace=self.populate_should_replace,
lenient=lenient,
)
zone.add_record(record, replace=self.populate_should_replace)
self.log.info(
'populate: found %s records', len(zone.records) - before

View File

@@ -78,7 +78,6 @@ class Plan(object):
self.existing
and len(self.existing.records) >= self.MIN_EXISTING_RECORDS
):
existing_record_count = len(self.existing.records)
if existing_record_count > 0:
update_pcent = (

View File

@@ -41,6 +41,10 @@ class Record(EqualityTupleMixin):
# convert the error into a reason
reasons.append(str(e))
name = str(name)
if ' ' in name or '\t' in name:
reasons.append('invalid record, whitespace is not allowed')
fqdn = f'{name}.{zone.name}' if name else zone.name
try:
_type = data['type']

View File

@@ -13,7 +13,7 @@ class ValidationError(RecordException):
@classmethod
def build_message(cls, fqdn, reasons):
reasons = '\n - '.join(reasons)
return f'Invalid record {idna_decode(fqdn)}\n - {reasons}'
return f'Invalid record "{idna_decode(fqdn)}"\n - {reasons}'
def __init__(self, fqdn, reasons):
super().__init__(self.build_message(fqdn, reasons))

View File

@@ -4,7 +4,6 @@
class BaseSource(object):
SUPPORTS_MULTIVALUE_PTR = False
SUPPORTS_POOL_VALUE_STATUS = False
SUPPORTS_ROOT_NS = False

View File

@@ -28,6 +28,9 @@ class Zone(object):
def __init__(self, name, sub_zones):
if not name[-1] == '.':
raise Exception(f'Invalid zone name {name}, missing ending dot')
elif ' ' in name or '\t' in name:
raise Exception(f'Invalid zone name {name}, whitespace not allowed')
# internally everything is idna
self.name = idna_encode(str(name)) if name else name
# we'll keep a decoded version around for logs and errors