diff --git a/CHANGELOG.md b/CHANGELOG.md index 264a923..2449878 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/octodns/record/geo.py b/octodns/record/geo.py index 0123b91..af8337c 100644 --- a/octodns/record/geo.py +++ b/octodns/record/geo.py @@ -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)) diff --git a/tests/test_octodns_record_geo.py b/tests/test_octodns_record_geo.py index b7701c8..420570e 100644 --- a/tests/test_octodns_record_geo.py +++ b/tests/test_octodns_record_geo.py @@ -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