Browse Source

Add Manager.process_config method

zone-config-cleanup
Ross McFarland 2 months ago
parent
commit
4f086c4677
No known key found for this signature in database GPG Key ID: 943B179E15D3B22A
1 changed files with 22 additions and 1 deletions
  1. +22
    -1
      octodns/manager.py

+ 22
- 1
octodns/manager.py View File

@ -121,7 +121,9 @@ class Manager(object):
# Read our config file
with open(config_file, 'r') as fh:
self.config = safe_load(fh, enforce_order=False)
config = safe_load(fh, enforce_order=False)
self.config = self.process_config(config)
self._validate_idna(self.config['zones'].keys())
@ -193,6 +195,25 @@ class Manager(object):
}
self.plan_outputs = self._config_plan_outputs(plan_outputs_config)
def process_config(self, config):
'''
Process and potentially modify the configuration before use.
This method is called during Manager initialization and provides a hook
for subclasses to transform or validate the configuration dictionary
before it is processed by the Manager.
:param config: The raw configuration dictionary loaded from the config file, may be modified and returned
:type config: dict
:return: The processed configuration dictionary
:rtype: dict
.. note::
The default implementation returns the config unmodified. Subclasses
can override this method to perform custom configuration processing.
'''
return config
def _validate_idna(self, names):
names = {n.lower() for n in names}
# verify that we don't have zones both with and without idna encoding


Loading…
Cancel
Save