Skip to content

Commit

Permalink
Bump required octodns >= 1.5, address pending deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
ross committed Oct 27, 2024
1 parent 6a0e162 commit 93fa448
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 76 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
26 changes: 0 additions & 26 deletions octodns_gcore/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down
2 changes: 0 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "."
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
16 changes: 1 addition & 15 deletions tests/config/unit.tests.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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:
Expand Down
32 changes: 0 additions & 32 deletions tests/test_octodns_provider_gcore.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 93fa448

Please sign in to comment.