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

Cloudflare export to BIND zone format - missing priority attribute #1428

Closed
gh-jamesmontgomery opened this issue Feb 17, 2020 · 1 comment
Closed

Comments

@gh-jamesmontgomery
Copy link

@gh-jamesmontgomery gh-jamesmontgomery commented Feb 17, 2020

Summary

I have used 2.8.x and the trunk version - in both versions, I cannot access the priority value for a record, or export the zone to bind format without a key error.

Detailed Information

The following traceback is generated from zone.export_to_bind_format():

Traceback (most recent call last):
  File "", line 1, in
  File "/dns-copy/venv/lib/python3.7/site-packages/libcloud/dns/base.py", line 78, in export_to_bind_format
    return self.driver.export_zone_to_bind_format(zone=self)
  File "/dns-copy/venv/lib/python3.7/site-packages/libcloud/dns/base.py", line 418, in export_zone_to_bind_format
    line = self._get_bind_record_line(record=record)
  File "/dns-copy/venv/lib/python3.7/site-packages/libcloud/dns/base.py", line 478, in _get_bind_record_line
    priority = str(record.extra['priority'])
KeyError: 'priority'

I was able to resolve the error by adding priority to 'libcloud/libcloud/dns/drivers/cloudflare.py':

RECORD_EXTRA_ATTRIBUTES = {
    'proxiable',
    'proxied',
    'locked',
    'created_on',
    'modified_on',
    'data',
    'priority'
}

I can export to BIND format and retrieve MX record priorities with this change.

@Kami

This comment has been minimized.

Copy link
Member

@Kami Kami commented Feb 17, 2020

Thanks for reporting this.

I was able to reproduce the issue and also confirmed the fix. I pushed a fix in #1429.

Next time, please feel free to open a PR (and ideally also with tests) yourself :)

@Kami Kami closed this in fde71d2 Feb 17, 2020
Kami added a commit to Kami/libcloud that referenced this issue Feb 29, 2020
to the record.extra dictionary.

Without it, export_to_bind_format() method doesn't work.

Resolves apache#1428
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.