From 93fa448ae4428a34ebdf154073a021913d91fd9d Mon Sep 17 00:00:00 2001 From: Ross McFarland Date: Sat, 26 Oct 2024 17:06:23 -0700 Subject: [PATCH] Bump required octodns >= 1.5, address pending deprecations --- CHANGELOG.md | 12 +++++++++++ octodns_gcore/__init__.py | 26 ---------------------- pyproject.toml | 2 -- setup.py | 2 +- tests/config/unit.tests.yaml | 16 +------------- tests/test_octodns_provider_gcore.py | 32 ---------------------------- 6 files changed, 14 insertions(+), 76 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4cb81d6..cce5d11 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,15 @@ +## v1.0.0 - 2024-??-?? - ??? + +Noteworthy Changes: + +* Complete removal of SPF record support, records should be transitioned to TXT + values before updating to this version. +* Removal of support for legacy `geo` targeting, records should be transitioned + to `dynamic` before updating to this version. + +Changes: + +* Address pending octoDNS 2.x deprecations, require minimum of 1.5.x ## v0.0.5 - 2023-12-xx - Root NS support * Add support for root NS updates diff --git a/octodns_gcore/__init__.py b/octodns_gcore/__init__.py index 17aca34..da7324d 100644 --- a/octodns_gcore/__init__.py +++ b/octodns_gcore/__init__.py @@ -832,32 +832,6 @@ def _process_desired_zone(self, desired): record = record.copy() record.dynamic.rules = rules desired.add_record(record, replace=True) - elif getattr(record, "geo", False): - geos = set(record.geo.keys()) - filtered_geos = { - g - for g in geos - if not g.startswith('NA-US-') and not g.startswith("NA-CA-") - } - if not filtered_geos: - msg = f'NA-US- and NA-CA-* not supported for {record.fqdn}' - fallback = 'skipping rule 0' - self.supports_warn_or_except(msg, fallback) - elif geos != filtered_geos: - msg = f'NA-US- and NA-CA-* not supported for {record.fqdn}' - before = ', '.join(geos) - after = ', '.join(filtered_geos) - fallback = f'filtering rule 0 from ({before}) to ({after})' - self.supports_warn_or_except(msg, fallback) - if geos != filtered_geos: - record = record.copy() - new_geo = { - geo: value - for geo, value in record.geo.items() - if geo in filtered_geos - } - record.geo = new_geo - desired.add_record(record, replace=True) return super()._process_desired_zone(desired) diff --git a/pyproject.toml b/pyproject.toml index dee82f2..d49293f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,7 +13,5 @@ sections="FUTURE,STDLIB,THIRDPARTY,OCTODNS,FIRSTPARTY,LOCALFOLDER" [tool.pytest.ini_options] filterwarnings = [ 'error', - # TODO: remove once octodns 2.0 has been released - 'ignore:.*DEPRECATED.*2.0', ] pythonpath = "." diff --git a/setup.py b/setup.py index 200a88a..1fff013 100755 --- a/setup.py +++ b/setup.py @@ -42,7 +42,7 @@ def version(): ), 'test': tests_require, }, - install_requires=('octodns>=0.9.14', 'requests>=2.27.0'), + install_requires=('octodns>=1.5.0', 'requests>=2.27.0'), license='MIT', long_description=long_description, long_description_content_type='text/markdown', diff --git a/tests/config/unit.tests.yaml b/tests/config/unit.tests.yaml index 6e06d4b..0f13792 100644 --- a/tests/config/unit.tests.yaml +++ b/tests/config/unit.tests.yaml @@ -1,16 +1,6 @@ --- ? '' -: - geo: - AF: - - 2.2.3.4 - - 2.2.3.5 - AS-JP: - - 3.2.3.4 - - 3.2.3.5 - NA-US: - - 4.2.3.4 - - 4.2.3.5 - ttl: 300 +: - ttl: 300 type: A values: - 1.2.3.4 @@ -152,10 +142,6 @@ ptr: ttl: 300 type: PTR values: [foo.bar.com.] -spf: - ttl: 600 - type: SPF - value: v=spf1 ip4:192.168.0.1/16-all sub: type: 'NS' values: diff --git a/tests/test_octodns_provider_gcore.py b/tests/test_octodns_provider_gcore.py index 6cb8638..93fbd4b 100644 --- a/tests/test_octodns_provider_gcore.py +++ b/tests/test_octodns_provider_gcore.py @@ -1203,38 +1203,6 @@ def test__process_desired_zone_dynamic(self): and not g.startswith("NA-CA-") ] - def test__process_desired_zone_not_dynamic(self): - provider = GCoreProvider( - "test_id", token="token", strict_supports=False - ) - geos = [ - {"AF": ["2.2.3.4", "2.2.3.5"], "NA-US-CA": ["5.2.3.4", "5.2.3.5"]}, - {"AF": ["2.2.3.4", "2.2.3.5"]}, - {"NA-US-CA": ["5.2.3.4", "5.2.3.5"]}, - ] - for i in geos: - data = { - "geo": i, - "ttl": 60, - "type": "A", - "values": ["1.2.3.4", "1.2.3.5"], - } - zone1 = Zone("unit.tests.", []) - record1 = Record.new(zone1, "test", data=data) - - zone1.add_record(record1) - result = provider._process_desired_zone(zone1.copy()) - for record in result.records: - geos = record.data.get("geo", {}) - assert sorted(geos.keys()) == sorted( - [ - g - for g in geos - if not g.startswith('NA-US-') - and not g.startswith("NA-CA-") - ] - ) - def test__process_desired_zone_dynamic_healthcheck(self): provider = GCoreProvider( "test_id", token="token", strict_supports=False