gh-jamesmontgomery opened a new issue #1428: Cloudflare export to BIND zone 
format - missing priority attribute 
URL: https://github.com/apache/libcloud/issues/1428
 
 
   ## 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 "<stdin>", line 1, in <module>
     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':
   
   ```python
   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.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to