mirror of
https://github.com/github/octodns.git
synced 2024-05-11 05:55:00 +00:00
manager: error when an alias zone is synced without its source
Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
This commit is contained in:
@@ -375,12 +375,19 @@ class Manager(object):
|
||||
futures = []
|
||||
for zone_name, zone_source in aliased_zones.items():
|
||||
source_config = self.config['zones'][zone_source]
|
||||
print(source_config)
|
||||
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(
|
||||
self._populate_and_plan,
|
||||
zone_name,
|
||||
[],
|
||||
[self.providers[t] for t in source_config['targets']],
|
||||
desired=desired[zone_source],
|
||||
desired=desired_config,
|
||||
lenient=lenient
|
||||
))
|
||||
|
||||
|
@@ -191,6 +191,14 @@ class TestManager(TestCase):
|
||||
'zone alias.tests. is an alias zone',
|
||||
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):
|
||||
with TemporaryDirectory() as tmpdir:
|
||||
environ['YAML_TMP_DIR'] = tmpdir.dirname
|
||||
|
Reference in New Issue
Block a user