solvaholic / octodns-sync

GitHub Action to test and deploy DNS settings with OctoDNS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OVH DKIM record: module 'base64' has no attribute 'decodestring'

barnumbirr opened this issue · comments

Hello,

What I did

I tried to add DKIM records to a domain using the OVH provider.

What I expected to happen

DKIM record is added successfully

What happened instead

 2020-12-05T03:15:34  [139931131193152] INFO  OvhProvider[ovh] apply: making changes
2020-12-05T03:15:34  [139931131193152] INFO  OvhProvider[ovh] _apply: zone=kosmonaut.lu., len(changes)=8
Traceback (most recent call last):
  File "/usr/local/bin/octodns-sync", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/site-packages/octodns/cmds/sync.py", line 38, in main
    manager.sync(eligible_zones=args.zone, eligible_targets=args.target,
  File "/usr/local/lib/python3.9/site-packages/octodns/manager.py", line 344, in sync
    total_changes += target.apply(plan)
  File "/usr/local/lib/python3.9/site-packages/octodns/provider/base.py", line 95, in apply
    self._apply(plan)
  File "/usr/local/lib/python3.9/site-packages/octodns/provider/ovh.py", line 101, in _apply
    getattr(self, '_apply_{}'.format(class_name).lower())(zone_name,
  File "/usr/local/lib/python3.9/site-packages/octodns/provider/ovh.py", line 110, in _apply_create
    for params in params_for(new):
  File "/usr/local/lib/python3.9/site-packages/octodns/provider/ovh.py", line 325, in _params_for_TXT
    if self._is_valid_dkim(value):
  File "/usr/local/lib/python3.9/site-packages/octodns/provider/ovh.py", line 361, in _is_valid_dkim
    is_valid_key = self._is_valid_dkim_key(value)
  File "/usr/local/lib/python3.9/site-packages/octodns/provider/ovh.py", line 374, in _is_valid_dkim_key
    base64.decodestring(bytearray(key, 'utf-8'))
AttributeError: module 'base64' has no attribute 'decodestring'

Additional info

This error could be blamed on several factors:

  1. octodns-sync is pinned to "old" octodns version, running v0.9.10 even though v0.9.11 was released about a month ago.
  2. Usage of Python 3.9 even though octodns wasn't being tested on that specific version up until a few days ago.

Regarding 1), running the latest version of octodns wouldn't have helped in this case. A PR to fix the issue was merged two days ago but no new release was created. This PR also introduced CI/CD for Python 3.9 (see 2)).
In this particular instance, the easiest fix would be to downgrade octodns-sync's Python version to 3.7. It would however require a discussion on how to handle versioning of upstream in the future,

Cheers.

Just tested locally after downgrading to Python 3.7 and upgrading octodns to v0.9.11 (not strictly necessary), works like a charm.

🎉 Thank you @barnumbirr !

I appreciate you providing these details and demonstrating downgrading python eliminated the problem.

I'd like to work out the version changes in #25. Let's keep this open for now, so it doesn't get lost.

Hey @solvaholic,

thanks for looking into this. Just my two cents:

  • couldn't we loosen the requirement on octodns ? Pulling from the projects master branch might be a bit optimistic, we could however always pull the latest version released to PyPi.
  • it might be a good idea to tighten requirements on the Python version to prevent cases like this, where upstream hasn't caught on with newer Python versions.

Hi @barnumbirr 👋

I took both your suggestions, to upgrade octodns and downgrade Python. Thanks again for sorting this out.

Please test with the changes in main and let me know how it goes. You can run locally or use the @main version of the action:

        uses: solvaholic/octodns-sync@main

Hi @solvaholic,

both this issue and the one in #23 have been fixed in main, nicely done. 🎉
Thanks again for looking into these and thanks for creating octodns-sync.