From e92c1079c9655b1d2ee190561c371a82d65819d8 Mon Sep 17 00:00:00 2001 From: Viranch Mehta Date: Mon, 18 Sep 2023 21:16:50 -0700 Subject: [PATCH 1/2] Fix wrong re-use of sources for dynamic zones --- octodns/manager.py | 4 ++-- tests/config/dynamic-config.yaml | 12 +++++++++++- tests/test_octodns_manager.py | 8 ++++++-- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/octodns/manager.py b/octodns/manager.py index 95b7ed6..1753269 100644 --- a/octodns/manager.py +++ b/octodns/manager.py @@ -516,11 +516,11 @@ class Manager(object): # we've found a dynamic config element # find its sources - sources = sources or self._get_sources( + found_sources = sources or self._get_sources( name, config, eligible_sources ) self.log.info('sync: dynamic zone=%s, sources=%s', name, sources) - for source in sources: + for source in found_sources: if not hasattr(source, 'list_zones'): raise ManagerException( f'dynamic zone={name} includes a source, {source.id}, that does not support `list_zones`' diff --git a/tests/config/dynamic-config.yaml b/tests/config/dynamic-config.yaml index 233b831..cf9c460 100644 --- a/tests/config/dynamic-config.yaml +++ b/tests/config/dynamic-config.yaml @@ -3,17 +3,27 @@ providers: class: octodns.provider.yaml.YamlProvider directory: tests/config + in2: + class: octodns.provider.yaml.YamlProvider + directory: tests/config/split + dump: class: octodns.provider.yaml.YamlProvider directory: env/YAML_TMP_DIR zones: - '*': + '*.one': sources: - in targets: - dump + '*.two': + sources: + - in2 + targets: + - dump + subzone.unit.tests.: sources: - in diff --git a/tests/test_octodns_manager.py b/tests/test_octodns_manager.py index 19dc78f..ae2f415 100644 --- a/tests/test_octodns_manager.py +++ b/tests/test_octodns_manager.py @@ -997,10 +997,14 @@ class TestManager(TestCase): manager = Manager(get_config_filename('dynamic-config.yaml')) - # just unit.tests. which should have been dynamically configured via + # two zones which should have been dynamically configured via # list_zones self.assertEqual( - 23, manager.sync(eligible_zones=['unit.tests.'], dry_run=False) + 29, + manager.sync( + eligible_zones=['unit.tests.', 'dynamic.tests.'], + dry_run=False, + ), ) # just subzone.unit.tests. which was explicitly configured From f599358a2c894d0d9619ab04cc6b1e6b769cd50a Mon Sep 17 00:00:00 2001 From: Viranch Mehta Date: Tue, 19 Sep 2023 11:17:50 -0700 Subject: [PATCH 2/2] CHANGELOG entry --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f82be4..09608f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ * Fix crash bug when using the YamlProvider with a directory that contains a mix of split and non-split zone yamls. See https://github.com/octodns/octodns/issues/1066 +* Fix discovery of zones from different sources when there are multiple dynamic + zones. See https://github.com/octodns/octodns/issues/1068 ## v1.1.1 - 2023-09-16 - Doh! Fix that one little thing