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

Validate processor config sections

This commit is contained in:
Ross McFarland
2021-06-23 18:49:19 -07:00
parent 92b5b774be
commit c3f0bf677a
3 changed files with 31 additions and 2 deletions

View File

@@ -573,8 +573,15 @@ class Manager(object):
if isinstance(source, YamlProvider):
source.populate(zone)
# TODO: validate
# processors = config.get('processors', [])
# check that processors are in order if any are specified
processors = config.get('processors', [])
try:
# same as above, but for processors this time
for processor in processors:
collected.append(self.processors[processor])
except KeyError:
raise ManagerException('Zone {}, unknown processor: {}'
.format(zone_name, processor))
def get_zone(self, zone_name):
if not zone_name[-1] == '.':

View File

@@ -0,0 +1,17 @@
manager:
max_workers: 2
providers:
in:
class: octodns.provider.yaml.YamlProvider
directory: tests/config
dump:
class: octodns.provider.yaml.YamlProvider
directory: env/YAML_TMP_DIR
zones:
unit.tests.:
sources:
- in
processors:
- missing
targets:
- dump

View File

@@ -339,6 +339,11 @@ class TestManager(TestCase):
Manager(get_config_filename('simple-alias-zone.yaml')) \
.validate_configs()
with self.assertRaises(ManagerException) as ctx:
Manager(get_config_filename('unknown-processor.yaml')) \
.validate_configs()
self.assertTrue('unknown processor' in text_type(ctx.exception))
def test_get_zone(self):
Manager(get_config_filename('simple.yaml')).get_zone('unit.tests.')