Implement octodns-sync --source

It can be useful to only synchronize zones that use a certain source. For
example, in a situation where some zones use a dynamic source and others don't,
you probably want to synchronize those with a dynamic source regularly, and
only synchronize the others when a change is made.

Although we only synchronize the zones that use a given source, we still want
to synchronize all sources to avoid deleting records that would live in another
source of the zone.
This commit is contained in:
Guillaume Gelin
2020-08-27 16:16:24 +02:00
parent 451e169777
commit 31105cc472
3 changed files with 23 additions and 8 deletions
+8
View File
@@ -151,6 +151,14 @@ class TestManager(TestCase):
.sync(dry_run=False, force=True)
self.assertEquals(25, tc)
def test_eligible_sources(self):
with TemporaryDirectory() as tmpdir:
environ['YAML_TMP_DIR'] = tmpdir.dirname
# Only allow a target that doesn't exist
tc = Manager(get_config_filename('simple.yaml')) \
.sync(eligible_sources=['foo'])
self.assertEquals(0, tc)
def test_eligible_targets(self):
with TemporaryDirectory() as tmpdir:
environ['YAML_TMP_DIR'] = tmpdir.dirname