Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump required octodns >= 1.5, address pending deprecations #63

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
## v1.0.0 - 2024-??-?? - ???

Noteworthy Changes:

* Complete removal of SPF record support, records should be transitioned to TXT
values before updating to this version.

Changes:

* Address pending octoDNS 2.x deprecations, require minimum of 1.5.x

## v0.0.5 - 2024-06-20 - refactor API code

* Use a common code base for ConstellixClient and SonarClient
Expand Down
22 changes: 3 additions & 19 deletions octodns_constellix/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,19 +431,7 @@ class ConstellixProvider(BaseProvider):
SUPPORTS_DYNAMIC = True
SUPPORTS_ROOT_NS = False
SUPPORTS = set(
(
'A',
'AAAA',
'ALIAS',
'CAA',
'CNAME',
'MX',
'NS',
'PTR',
'SPF',
'SRV',
'TXT',
)
('A', 'AAAA', 'ALIAS', 'CAA', 'CNAME', 'MX', 'NS', 'PTR', 'SRV', 'TXT')
)

def __init__(
Expand Down Expand Up @@ -643,8 +631,6 @@ def _data_for_TXT(self, _type, records):
]
return {'ttl': records[0]['ttl'], 'type': _type, 'values': values}

_data_for_SPF = _data_for_TXT

def _data_for_MX(self, _type, records):
values = []
record = records[0]
Expand Down Expand Up @@ -727,13 +713,13 @@ def populate(self, zone, target=False, lenient=False):
return exists

def _is_healthcheck_configured(self, record):
sonar_healthcheck = record._octodns.get('constellix', {}).get(
sonar_healthcheck = record.octodns.get('constellix', {}).get(
'healthcheck', None
)
return sonar_healthcheck is not None

def _healthcheck_config(self, record):
sonar_healthcheck = record._octodns.get('constellix', {}).get(
sonar_healthcheck = record.octodns.get('constellix', {}).get(
'healthcheck', None
)

Expand Down Expand Up @@ -815,8 +801,6 @@ def _params_for_TXT(self, record):
)
yield {'name': record.name, 'ttl': record.ttl, 'roundRobin': values}

_params_for_SPF = _params_for_TXT

def _params_for_CAA(self, record):
values = []
for value in record.values:
Expand Down
2 changes: 0 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ 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',
# pycountry_mappings -> repoze.lru ->
'ignore:pkg_resources is deprecated',
'ignore:Deprecated call to `pkg_resources.declare_namespace',
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def version():
'test': tests_require,
},
install_requires=(
'octodns>=0.9.14',
'octodns>=1.5.0',
'pycountry-convert>=0.7.2',
'requests>=2.27.0',
),
Expand Down
19 changes: 1 addition & 18 deletions tests/config/unit.tests.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +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
NA-US-CA:
- 5.2.3.4
- 5.2.3.5
ttl: 300
: - ttl: 300
type: A
values:
- 1.2.3.4
Expand Down Expand Up @@ -153,10 +140,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
22 changes: 0 additions & 22 deletions tests/fixtures/constellix-records.json
Original file line number Diff line number Diff line change
Expand Up @@ -436,28 +436,6 @@
"value": "foo.bar.com.",
"disableFlag": false
}]
}, {
"id": 1808526,
"type": "SPF",
"recordType": "spf",
"name": "spf",
"recordOption": "roundRobin",
"noAnswer": false,
"note": "",
"ttl": 600,
"gtdRegion": 1,
"parentId": 123123,
"parent": "domain",
"source": "Domain",
"modifiedTs": 1565149916132,
"value": [{
"value": "\"v=spf1 ip4:192.168.0.1/16-all\"",
"disableFlag": false
}],
"roundRobin": [{
"value": "\"v=spf1 ip4:192.168.0.1/16-all\"",
"disableFlag": false
}]
}, {
"id": 1808528,
"type": "TXT",
Expand Down
27 changes: 8 additions & 19 deletions tests/test_provider_constellix.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ def populate_expected(self, zone_name):
# Add our NS record and remove the default test case.
for record in list(expected.records):
if record.name == 'sub' and record._type == 'NS':
expected._remove_record(record)
expected.remove_record(record)
if record.name == '' and record._type == 'NS':
expected._remove_record(record)
expected.remove_record(record)
expected.add_record(
Record.new(
expected,
Expand Down Expand Up @@ -256,16 +256,17 @@ def test_populate(self):

zone = Zone('unit.tests.', [])
provider.populate(zone)
self.assertEqual(18, len(zone.records))
self.assertEqual(17, len(zone.records))
changes = expected.changes(zone, provider)
print(changes)
self.assertEqual(0, len(changes))

self.assertEqual(['unit.tests.'], provider.list_zones())

# 2nd populate makes no network calls/all from cache
again = Zone('unit.tests.', [])
provider.populate(again)
self.assertEqual(18, len(again.records))
self.assertEqual(17, len(again.records))

# Bust the cache.
del provider._zone_records[zone.name]
Expand Down Expand Up @@ -319,22 +320,21 @@ def test_apply(self):
[],
[],
[],
[],
]
resp.json.side_effect = resp_side_effect

plan = provider.plan(expected)

# 24 records given in unit.tests.yaml
# 23 records given in unit.tests.yaml
# 1 ALIAS record added
# 1 Root NS record removed by test setup
# 24 records exepected
# 23 records exepected
# 1 ignored
# 1 exclued
# 5 unsupported: URLFWD, NAPTR, LOC, SSHFP, DNAME
# 7 records not applied
# 18 records applied
self.assertEqual(len(expected.records), 24)
self.assertEqual(len(expected.records), 23)
n = len(expected.records) - 7
self.assertEqual(n, len(plan.changes))
self.assertEqual(n, provider.apply(plan))
Expand Down Expand Up @@ -517,17 +517,6 @@ def test_apply(self):
],
},
),
call(
'POST',
'/domains/123123/records/SPF',
data={
'name': 'spf',
'ttl': 600,
'roundRobin': [
{'value': '"v=spf1 ip4:192.168.0.1/16-all"'}
],
},
),
call(
'POST',
'/domains/123123/records/TXT',
Expand Down
Loading