From 686868ca3552eed2be2ba55f7ef0b2ac16aa1051 Mon Sep 17 00:00:00 2001 From: Ross McFarland Date: Wed, 13 Sep 2023 12:31:49 -0700 Subject: [PATCH] Processor.name -> id to match everything else --- octodns/processor/acme.py | 4 ++-- octodns/processor/arpa.py | 6 +++--- octodns/processor/base.py | 5 +++-- octodns/processor/filter.py | 20 ++++++++++---------- octodns/processor/ownership.py | 4 ++-- octodns/processor/restrict.py | 4 ++-- octodns/processor/spf.py | 6 +++--- 7 files changed, 25 insertions(+), 24 deletions(-) diff --git a/octodns/processor/acme.py b/octodns/processor/acme.py index 793f95a..89804b1 100644 --- a/octodns/processor/acme.py +++ b/octodns/processor/acme.py @@ -10,7 +10,7 @@ from .base import BaseProcessor class AcmeMangingProcessor(BaseProcessor): log = getLogger('AcmeMangingProcessor') - def __init__(self, name): + def __init__(self, id): ''' processors: acme: @@ -25,7 +25,7 @@ class AcmeMangingProcessor(BaseProcessor): - acme ... ''' - super().__init__(name) + super().__init__(id) self._owned = set() diff --git a/octodns/processor/arpa.py b/octodns/processor/arpa.py index 7de4c1c..295de62 100644 --- a/octodns/processor/arpa.py +++ b/octodns/processor/arpa.py @@ -11,9 +11,9 @@ from .base import BaseProcessor class AutoArpa(BaseProcessor): - def __init__(self, name, ttl=3600, populate_should_replace=False): - super().__init__(name) - self.log = getLogger(f'AutoArpa[{name}]') + def __init__(self, id, ttl=3600, populate_should_replace=False): + super().__init__(id) + self.log = getLogger(f'AutoArpa[{id}]') self.log.info( '__init__: ttl=%d, populate_should_replace=%s', ttl, diff --git a/octodns/processor/base.py b/octodns/processor/base.py index 5279af2..76f45a9 100644 --- a/octodns/processor/base.py +++ b/octodns/processor/base.py @@ -8,8 +8,9 @@ class ProcessorException(Exception): class BaseProcessor(object): - def __init__(self, name): - self.name = name + def __init__(self, id): + # TODO: name is DEPRECATED and will be removed with 2.0 + self.id = self.name = id def process_source_zone(self, desired, sources): ''' diff --git a/octodns/processor/filter.py b/octodns/processor/filter.py index f661dbf..b9ad20d 100644 --- a/octodns/processor/filter.py +++ b/octodns/processor/filter.py @@ -29,8 +29,8 @@ class TypeAllowlistFilter(BaseProcessor): - ns1 ''' - def __init__(self, name, allowlist): - super().__init__(name) + def __init__(self, id, allowlist): + super().__init__(id) self.allowlist = set(allowlist) def _process(self, zone, *args, **kwargs): @@ -65,8 +65,8 @@ class TypeRejectlistFilter(BaseProcessor): - route53 ''' - def __init__(self, name, rejectlist): - super().__init__(name) + def __init__(self, id, rejectlist): + super().__init__(id) self.rejectlist = set(rejectlist) def _process(self, zone, *args, **kwargs): @@ -81,8 +81,8 @@ class TypeRejectlistFilter(BaseProcessor): class _NameBaseFilter(BaseProcessor): - def __init__(self, name, _list): - super().__init__(name) + def __init__(self, id, _list): + super().__init__(id) exact = set() regex = [] for pattern in _list: @@ -122,8 +122,8 @@ class NameAllowlistFilter(_NameBaseFilter): - route53 ''' - def __init__(self, name, allowlist): - super().__init__(name, allowlist) + def __init__(self, id, allowlist): + super().__init__(id, allowlist) def _process(self, zone, *args, **kwargs): for record in zone.records: @@ -169,8 +169,8 @@ class NameRejectlistFilter(_NameBaseFilter): - route53 ''' - def __init__(self, name, rejectlist): - super().__init__(name, rejectlist) + def __init__(self, id, rejectlist): + super().__init__(id, rejectlist) def _process(self, zone, *args, **kwargs): for record in zone.records: diff --git a/octodns/processor/ownership.py b/octodns/processor/ownership.py index ed8f34a..211742d 100644 --- a/octodns/processor/ownership.py +++ b/octodns/processor/ownership.py @@ -13,8 +13,8 @@ from .base import BaseProcessor # delete. We'll take ownership of existing records that we're told to manage # and thus "own" them going forward. class OwnershipProcessor(BaseProcessor): - def __init__(self, name, txt_name='_owner', txt_value='*octodns*'): - super().__init__(name) + def __init__(self, id, txt_name='_owner', txt_value='*octodns*'): + super().__init__(id) self.txt_name = txt_name self.txt_value = txt_value self._txt_values = [txt_value] diff --git a/octodns/processor/restrict.py b/octodns/processor/restrict.py index e585eeb..20a11a7 100644 --- a/octodns/processor/restrict.py +++ b/octodns/processor/restrict.py @@ -51,8 +51,8 @@ class TtlRestrictionFilter(BaseProcessor): SEVEN_DAYS = 60 * 60 * 24 * 7 - def __init__(self, name, min_ttl=1, max_ttl=SEVEN_DAYS, allowed_ttls=None): - super().__init__(name) + def __init__(self, id, min_ttl=1, max_ttl=SEVEN_DAYS, allowed_ttls=None): + super().__init__(id) self.min_ttl = min_ttl self.max_ttl = max_ttl self.allowed_ttls = set(allowed_ttls) if allowed_ttls else None diff --git a/octodns/processor/spf.py b/octodns/processor/spf.py index dee82ed..862930f 100644 --- a/octodns/processor/spf.py +++ b/octodns/processor/spf.py @@ -53,12 +53,12 @@ class SpfDnsLookupProcessor(BaseProcessor): log = getLogger('SpfDnsLookupProcessor') - def __init__(self, name): - self.log.debug(f"SpfDnsLookupProcessor: {name}") + def __init__(self, id): + self.log.debug('__init__:') self.log.warning( 'SpfDnsLookupProcessor is DEPRECATED in favor of the version relocated into octodns-spf and will be removed in 2.0' ) - super().__init__(name) + super().__init__(id) def _get_spf_from_txt_values( self, record: Record, values: List[str]