Browse Source

Merge branch 'master' into route53-sort-batches

pull/531/head
Ross McFarland 6 years ago
committed by GitHub
parent
commit
98c3a4732c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 46 additions and 6 deletions
  1. +7
    -5
      octodns/record/__init__.py
  2. +1
    -1
      requirements.txt
  3. +38
    -0
      tests/test_octodns_record.py

+ 7
- 5
octodns/record/__init__.py 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))


+ 1
- 1
requirements.txt 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


+ 38
- 0
tests/test_octodns_record.py 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 = {


Loading…
Cancel
Save