Browse Source

Validate processor config sections

pull/637/head
Ross McFarland 5 years ago
parent
commit
c3f0bf677a
No known key found for this signature in database GPG Key ID: 943B179E15D3B22A
3 changed files with 31 additions and 2 deletions
  1. +9
    -2
      octodns/manager.py
  2. +17
    -0
      tests/config/unknown-processor.yaml
  3. +5
    -0
      tests/test_octodns_manager.py

+ 9
- 2
octodns/manager.py 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] == '.':


+ 17
- 0
tests/config/unknown-processor.yaml 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

+ 5
- 0
tests/test_octodns_manager.py 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.')


Loading…
Cancel
Save