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.0, address pending deprecations #21

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
2 changes: 1 addition & 1 deletion octodns_spf/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def process_source_zone(self, zone, *args, **kwargs):
if record._type != 'TXT':
continue

if record._octodns.get('lenient'):
if record.octodns.get('lenient'):
continue

self.check_dns_lookups(record.fqdn, record.values, 0)
Expand Down
9 changes: 1 addition & 8 deletions octodns_spf/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,20 +237,13 @@ def populate(self, zone, target=False, lenient=False):

before = len(zone.records)

spf = None
txt = None
for record in zone.records:
if record.name == '':
if record._type == 'TXT':
txt = record
elif record._type == 'SPF':
spf = record

if spf:
raise SpfException(
'Existing SPF value found, cannot coexist, migrate to TXT', spf
)
elif txt:
if txt:
self.log.debug('populate: found existing TXT record')
# figure out which value is the existing SPF
try:
Expand Down
2 changes: 0 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,5 @@ sections="FUTURE,STDLIB,THIRDPARTY,OCTODNS,FIRSTPARTY,LOCALFOLDER"
log_level = 'DEBUG'
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>=1.0.0',),
install_requires=('octodns>=1.5.0',),
license='MIT',
long_description=long_description,
long_description_content_type='text/markdown',
Expand Down
21 changes: 2 additions & 19 deletions tests/test_source_octodns_spf.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,35 +461,18 @@ def test_has_apex_txt_with_spf_no_merging(self):
'values': ['Hello World 1!', 'v=spf1 -all', 'z Hello World 2!'],
},
)
apex_txt.context = 'needle'
zone.add_record(apex_txt)

with self.assertRaises(SpfException) as ctx:
self.no_mail.populate(zone)
exception = ctx.exception
self.assertEqual(
'Existing SPF value found in TXT record, merging not enabled',
'Existing SPF value found in TXT record, merging not enabled, from needle',
str(exception),
)
self.assertEqual(apex_txt, exception.record)

def test_has_spf(self):
zone = self.zone.copy()

apex_spf = Record.new(
zone, '', {'ttl': 43, 'type': 'SPF', 'values': ['v=spf1 -all']}
)
apex_spf.context = 'needle'
zone.add_record(apex_spf)

with self.assertRaises(SpfException) as ctx:
self.no_mail.populate(zone)
exception = ctx.exception
self.assertEqual(
'Existing SPF value found, cannot coexist, migrate to TXT, from needle',
str(exception),
)
self.assertEqual(apex_spf, exception.record)

def test_merging(self):
zone = self.zone.copy()

Expand Down
Loading