From 933a56d8f982d408bc394ec761cd019d2a57d34a Mon Sep 17 00:00:00 2001 From: Matt Date: Sun, 4 Nov 2018 10:32:06 +1100 Subject: [PATCH 1/2] Add - (non-empty) Record._octodns dict to YAML file output. --- octodns/provider/yaml.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/octodns/provider/yaml.py b/octodns/provider/yaml.py index 287fd3b..7c9a915 100644 --- a/octodns/provider/yaml.py +++ b/octodns/provider/yaml.py @@ -89,6 +89,8 @@ class YamlProvider(BaseProvider): if record.ttl == self.default_ttl: # ttl is the default, we don't need to store it del d['ttl'] + if record._octodns: + d['octodns'] = record._octodns data[record.name].append(d) # Flatten single element lists From 84c883c67f5668ae3e5138bd4447b9f17063584d Mon Sep 17 00:00:00 2001 From: Matt Date: Sun, 4 Nov 2018 13:16:26 +1100 Subject: [PATCH 2/2] Add - Test case. --- tests/test_octodns_provider_yaml.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/test_octodns_provider_yaml.py b/tests/test_octodns_provider_yaml.py index 46363ed..8f1b4d3 100644 --- a/tests/test_octodns_provider_yaml.py +++ b/tests/test_octodns_provider_yaml.py @@ -60,6 +60,12 @@ class TestYamlProvider(TestCase): # There should be no changes after the round trip reloaded = Zone('unit.tests.', []) target.populate(reloaded) + self.assertDictEqual( + {'included': ['test']}, + filter( + lambda x: x.name == 'included', reloaded.records + )[0]._octodns) + self.assertFalse(zone.changes(reloaded, target=source)) # A 2nd sync should still create everything