Browse Source

Drop dynamic record value weight to 0-16

That's all Dyn supports and it's cleaner to match it than to scale dyn since
we'd lose precision we can't get back during populate.
pull/375/head
Ross McFarland 7 years ago
parent
commit
003e8651ce
No known key found for this signature in database GPG Key ID: 61C10C4FC8FE4A89
5 changed files with 9 additions and 9 deletions
  1. +1
    -1
      octodns/record/__init__.py
  2. +3
    -3
      tests/config/dynamic.tests.yaml
  3. +1
    -1
      tests/config/split/dynamic.tests./a.yaml
  4. +2
    -2
      tests/config/split/dynamic.tests./cname.yaml
  5. +2
    -2
      tests/test_octodns_record.py

+ 1
- 1
octodns/record/__init__.py View File

@ -514,7 +514,7 @@ class _DynamicMixin(object):
try:
weight = value['weight']
weight = int(weight)
if weight < 1 or weight > 255:
if weight < 1 or weight > 15:
reasons.append('invalid weight "{}" in pool "{}" '
'value {}'.format(weight, _id,
value_num))


+ 3
- 3
tests/config/dynamic.tests.yaml View File

@ -19,7 +19,7 @@ a:
- value: 6.6.6.6
weight: 10
- value: 5.5.5.5
weight: 25
weight: 15
rules:
- geos:
- EU-GB
@ -90,9 +90,9 @@ cname:
sea:
values:
- value: target-sea-1.unit.tests.
weight: 100
weight: 10
- value: target-sea-2.unit.tests.
weight: 175
weight: 14
rules:
- geos:
- EU-GB


+ 1
- 1
tests/config/split/dynamic.tests./a.yaml View File

@ -23,7 +23,7 @@ a:
fallback: null
values:
- value: 5.5.5.5
weight: 25
weight: 15
- value: 6.6.6.6
weight: 10
rules:


+ 2
- 2
tests/config/split/dynamic.tests./cname.yaml View File

@ -21,9 +21,9 @@ cname:
fallback: null
values:
- value: target-sea-1.unit.tests.
weight: 100
weight: 10
- value: target-sea-2.unit.tests.
weight: 175
weight: 14
rules:
- geos:
- EU-GB


+ 2
- 2
tests/test_octodns_record.py View File

@ -2460,7 +2460,7 @@ class TestDynamicRecords(TestCase):
'weight': 1,
'value': '6.6.6.6',
}, {
'weight': 256,
'weight': 16,
'value': '7.7.7.7',
}],
},
@ -2484,7 +2484,7 @@ class TestDynamicRecords(TestCase):
}
with self.assertRaises(ValidationError) as ctx:
Record.new(self.zone, 'bad', a_data)
self.assertEquals(['invalid weight "256" in pool "three" value 2'],
self.assertEquals(['invalid weight "16" in pool "three" value 2'],
ctx.exception.reasons)
# invalid non-int weight


Loading…
Cancel
Save