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:
@@ -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] == '.':
|
||||
|
17
tests/config/unknown-processor.yaml
Normal file
17
tests/config/unknown-processor.yaml
Normal 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
|
@@ -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.')
|
||||
|
||||
|
Reference in New Issue
Block a user