Browse Source

Deprecate geo records in favor of dynamic

pull/1032/head
Ross McFarland 2 years ago
parent
commit
303bc7740d
No known key found for this signature in database GPG Key ID: 943B179E15D3B22A
3 changed files with 23 additions and 9 deletions
  1. +4
    -0
      CHANGELOG.md
  2. +3
    -0
      octodns/record/geo.py
  3. +16
    -9
      tests/test_octodns_record_geo.py

+ 4
- 0
CHANGELOG.md View File

@ -1,5 +1,9 @@
## v1.0.0 - 2023-??-?? - The One
#### Noteworthy changes
* `geo` records are deprecated.
#### Stuff
* Removal of a Python 3.7 specific import work-around now that it's no longer an


+ 3
- 0
octodns/record/geo.py View File

@ -141,6 +141,9 @@ class _GeoMixin(ValuesMixin):
reasons = super().validate(name, fqdn, data)
try:
geo = dict(data['geo'])
cls.log.warning(
'NOTICE: `geo` record support is deprecated and should be migrated to `dynamic` records'
)
for code, values in geo.items():
reasons.extend(GeoValue._validate_geo(code))
reasons.extend(cls._value_type.validate(values, cls._type))


+ 16
- 9
tests/test_octodns_record_geo.py View File

@ -213,15 +213,22 @@ class TestRecordGeoCodes(TestCase):
self.assertTrue(c >= b)
def test_validation(self):
Record.new(
self.zone,
'',
{
'geo': {'NA': ['1.2.3.5'], 'NA-US': ['1.2.3.5', '1.2.3.6']},
'type': 'A',
'ttl': 600,
'value': '1.2.3.4',
},
with self.assertLogs('Record', level='WARNING') as cm:
Record.new(
self.zone,
'',
{
'geo': {'NA': ['1.2.3.5'], 'NA-US': ['1.2.3.5', '1.2.3.6']},
'type': 'A',
'ttl': 600,
'value': '1.2.3.4',
},
)
self.assertEqual(
[
'WARNING:Record:NOTICE: `geo` record support is deprecated and should be migrated to `dynamic` records'
],
cm.output,
)
# invalid ip address


Loading…
Cancel
Save