mirror of
https://github.com/github/octodns.git
synced 2024-05-11 05:55:00 +00:00
Merge branch 'master' into azuredns-dynamic
This commit is contained in:
@@ -583,6 +583,10 @@ class _DynamicMixin(object):
|
||||
reasons.append('missing value in pool "{}" '
|
||||
'value {}'.format(_id, value_num))
|
||||
|
||||
if len(values) == 1 and values[0].get('weight', 1) != 1:
|
||||
reasons.append('pool "{}" has single value with '
|
||||
'weight!=1'.format(_id))
|
||||
|
||||
fallback = pool.get('fallback', None)
|
||||
if fallback is not None:
|
||||
if fallback in pools:
|
||||
|
||||
@@ -3413,7 +3413,7 @@ class TestDynamicRecords(TestCase):
|
||||
self.assertEquals(['pool "one" is missing values'],
|
||||
ctx.exception.reasons)
|
||||
|
||||
# pool valu not a dict
|
||||
# pool value not a dict
|
||||
a_data = {
|
||||
'dynamic': {
|
||||
'pools': {
|
||||
@@ -3597,6 +3597,33 @@ class TestDynamicRecords(TestCase):
|
||||
self.assertEquals(['invalid weight "foo" in pool "three" value 2'],
|
||||
ctx.exception.reasons)
|
||||
|
||||
# single value with weight!=1
|
||||
a_data = {
|
||||
'dynamic': {
|
||||
'pools': {
|
||||
'one': {
|
||||
'values': [{
|
||||
'weight': 12,
|
||||
'value': '6.6.6.6',
|
||||
}],
|
||||
},
|
||||
},
|
||||
'rules': [{
|
||||
'pool': 'one',
|
||||
}],
|
||||
},
|
||||
'ttl': 60,
|
||||
'type': 'A',
|
||||
'values': [
|
||||
'1.1.1.1',
|
||||
'2.2.2.2',
|
||||
],
|
||||
}
|
||||
with self.assertRaises(ValidationError) as ctx:
|
||||
Record.new(self.zone, 'bad', a_data)
|
||||
self.assertEquals(['pool "one" has single value with weight!=1'],
|
||||
ctx.exception.reasons)
|
||||
|
||||
# invalid fallback
|
||||
a_data = {
|
||||
'dynamic': {
|
||||
|
||||
Reference in New Issue
Block a user