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

Deprecate geo records in favor of dynamic

This commit is contained in:
Ross McFarland
2023-07-30 06:40:17 -07:00
parent 0d8fcf490b
commit 303bc7740d
3 changed files with 23 additions and 9 deletions

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

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

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