1
0
mirror of https://github.com/github/octodns.git synced 2024-05-11 05:55:00 +00:00

Merge branch 'master' into route53-sort-batches

This commit is contained in:
Ross McFarland
2020-04-06 13:14:36 -07:00
committed by GitHub
3 changed files with 46 additions and 6 deletions

View File

@@ -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))

View File

@@ -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

View File

@@ -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 = {