From 54699e05ce89477031ce1ed87d4eb38071d2ca85 Mon Sep 17 00:00:00 2001 From: Ross McFarland Date: Thu, 2 Apr 2020 10:51:42 -0700 Subject: [PATCH 1/2] dynamic validation tweak, allow reuse of pool if 2nd occur is a default --- octodns/record/__init__.py | 12 +++++++----- tests/test_octodns_record.py | 38 ++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 5 deletions(-) diff --git a/octodns/record/__init__.py b/octodns/record/__init__.py index 0eb9431..384c0a2 100644 --- a/octodns/record/__init__.py +++ b/octodns/record/__init__.py @@ -590,6 +590,11 @@ class _DynamicMixin(object): reasons.append('rule {} missing pool'.format(rule_num)) continue + try: + geos = rule['geos'] + except KeyError: + geos = [] + if not isinstance(pool, string_types): reasons.append('rule {} invalid pool "{}"' .format(rule_num, pool)) @@ -598,15 +603,12 @@ class _DynamicMixin(object): reasons.append('rule {} undefined pool "{}"' .format(rule_num, pool)) pools_seen.add(pool) - elif pool in pools_seen: + elif pool in pools_seen and geos: reasons.append('rule {} invalid, target pool "{}" ' 'reused'.format(rule_num, pool)) pools_seen.add(pool) - try: - geos = rule['geos'] - except KeyError: - geos = [] + if not geos: if seen_default: reasons.append('rule {} duplicate default' .format(rule_num)) diff --git a/tests/test_octodns_record.py b/tests/test_octodns_record.py index 4216c52..f76f593 100644 --- a/tests/test_octodns_record.py +++ b/tests/test_octodns_record.py @@ -3417,6 +3417,7 @@ class TestDynamicRecords(TestCase): 'geos': ['AF'], 'pool': 'one', }, { + 'geos': ['OC'], 'pool': 'one', }], }, @@ -3432,6 +3433,43 @@ class TestDynamicRecords(TestCase): self.assertEquals(['rule 3 invalid, target pool "one" reused'], ctx.exception.reasons) + # Repeated pool is OK if later one is a default + a_data = { + 'dynamic': { + 'pools': { + 'one': { + 'values': [{ + 'value': '3.3.3.3', + }] + }, + 'two': { + 'values': [{ + 'value': '4.4.4.4', + }, { + 'value': '5.5.5.5', + }] + }, + }, + 'rules': [{ + 'geos': ['EU-GB'], + 'pool': 'one', + }, { + 'geos': ['EU'], + 'pool': 'two', + }, { + 'pool': 'one', + }], + }, + 'ttl': 60, + 'type': 'A', + 'values': [ + '1.1.1.1', + '2.2.2.2', + ], + } + # This should be valid, no exception + Record.new(self.zone, 'bad', a_data) + def test_dynamic_lenient(self): # Missing pools a_data = { From 67d661162fe576f16b5b97e1559bbb059dcdf8cb Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 2 Apr 2020 17:54:13 +0000 Subject: [PATCH 2/2] Bump boto3 from 1.12.11 to 1.12.34 Bumps [boto3](https://github.com/boto/boto3) from 1.12.11 to 1.12.34. - [Release notes](https://github.com/boto/boto3/releases) - [Changelog](https://github.com/boto/boto3/blob/develop/CHANGELOG.rst) - [Commits](https://github.com/boto/boto3/compare/1.12.11...1.12.34) Signed-off-by: dependabot-preview[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 7af6e6d..c125cc4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ PyYaml==5.3.1 azure-common==1.1.25 azure-mgmt-dns==3.0.0 -boto3==1.12.11 +boto3==1.12.34 botocore==1.15.34 dnspython==1.16.0 docutils==0.16