AutoArpa.replace -> populate_should_replace to match YamlProvider

This commit is contained in:
Ross McFarland
2023-02-27 09:12:21 -08:00
parent 3c2ad860f1
commit c67d44fc8a
2 changed files with 11 additions and 7 deletions
+3 -3
View File
@@ -14,9 +14,9 @@ Alternatively the value can be a dictionary with configuration options for the A
---
manager:
auto_arpa:
# Replace duplicate records rather than throw an error, default is False
# which throws an error
replace: False
# Whether duplicate records should replace rather than error
# (optiona, default False)
populate_should_replace: false
# Explicitly set the TTL of auto-created records, default is 3600s, 1hr
ttl: 1800
```
+8 -4
View File
@@ -11,12 +11,16 @@ from .base import BaseProcessor
class AutoArpa(BaseProcessor):
def __init__(self, name, ttl=3600, replace=False):
def __init__(self, name, ttl=3600, populate_should_replace=False):
super().__init__(name)
self.log = getLogger(f'AutoArpa[{name}]')
self.log.info('__init__: ttl=%d, replace=%s', ttl, replace)
self.log.info(
'__init__: ttl=%d, populate_should_replace=%s',
ttl,
populate_should_replace,
)
self.ttl = ttl
self.replace = replace
self.populate_should_replace = populate_should_replace
self._records = defaultdict(set)
def process_source_zone(self, desired, sources):
@@ -58,7 +62,7 @@ class AutoArpa(BaseProcessor):
name,
{'ttl': self.ttl, 'type': 'PTR', 'values': fqdns},
)
zone.add_record(record, replace=self.replace)
zone.add_record(record, replace=self.populate_should_replace)
self.log.info(
'populate: found %s records', len(zone.records) - before