Browse Source

Merge pull request #634 from rissson/alias-failing-test

manager: error when an alias zone is synced without its source
pull/652/head
Ross McFarland 5 years ago
committed by GitHub
parent
commit
20d34e0833
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 1 deletions
  1. +7
    -1
      octodns/manager.py
  2. +8
    -0
      tests/test_octodns_manager.py

+ 7
- 1
octodns/manager.py View File

@ -375,12 +375,18 @@ class Manager(object):
futures = [] futures = []
for zone_name, zone_source in aliased_zones.items(): for zone_name, zone_source in aliased_zones.items():
source_config = self.config['zones'][zone_source] source_config = self.config['zones'][zone_source]
try:
desired_config = desired[zone_source]
except KeyError:
raise ManagerException('Zone {} cannot be sync without zone '
'{} sinced it is aliased'
.format(zone_name, zone_source))
futures.append(self._executor.submit( futures.append(self._executor.submit(
self._populate_and_plan, self._populate_and_plan,
zone_name, zone_name,
[], [],
[self.providers[t] for t in source_config['targets']], [self.providers[t] for t in source_config['targets']],
desired=desired[zone_source],
desired=desired_config,
lenient=lenient lenient=lenient
)) ))


+ 8
- 0
tests/test_octodns_manager.py View File

@ -191,6 +191,14 @@ class TestManager(TestCase):
'zone alias.tests. is an alias zone', 'zone alias.tests. is an alias zone',
text_type(ctx.exception)) text_type(ctx.exception))
# Sync an alias without the zone it refers to
with self.assertRaises(ManagerException) as ctx:
tc = Manager(get_config_filename('simple-alias-zone.yaml')) \
.sync(eligible_zones=["alias.tests."])
self.assertEquals('Zone alias.tests. cannot be sync without zone '
'unit.tests. sinced it is aliased',
text_type(ctx.exception))
def test_compare(self): def test_compare(self):
with TemporaryDirectory() as tmpdir: with TemporaryDirectory() as tmpdir:
environ['YAML_TMP_DIR'] = tmpdir.dirname environ['YAML_TMP_DIR'] = tmpdir.dirname


Loading…
Cancel
Save