Repository: libcloud
Updated Branches:
  refs/heads/trunk 9fe309ddd -> 2b24d774f


Register priority for MX records

As is, this fails to split out the priority value from the raw record value, 
resulting in a key error for missing priority when trying to export in BIND 
format.  This is the quick hack I did to get the function to return a more 
useful Record.

Closes #718

Signed-off-by: Tomaz Muraus <to...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/f29960fb
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/f29960fb
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/f29960fb

Branch: refs/heads/trunk
Commit: f29960fbe01f6c3204eea84e62bfb51c7c9fb4c7
Parents: 9fe309d
Author: Ryan Lee <ryan...@zepheira.com>
Authored: Mon Feb 29 15:16:45 2016 -0500
Committer: Tomaz Muraus <to...@apache.org>
Committed: Tue Mar 1 16:01:02 2016 +0100

----------------------------------------------------------------------
 libcloud/dns/drivers/gandi.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/f29960fb/libcloud/dns/drivers/gandi.py
----------------------------------------------------------------------
diff --git a/libcloud/dns/drivers/gandi.py b/libcloud/dns/drivers/gandi.py
index 0e46d38..a7ca186 100644
--- a/libcloud/dns/drivers/gandi.py
+++ b/libcloud/dns/drivers/gandi.py
@@ -147,16 +147,20 @@ class GandiDNSDriver(BaseGandiDriver, DNSDriver):
         return res.object
 
     def _to_record(self, record, zone):
+        extras = {'ttl': record['ttl']}
+        value = record['value']
+        if record['type'] == 'MX':
+            extras['priority'] = record['value'].split(' ')[0]
+            value = record['value'].split(' ')[1]
         return Record(
             id='%s:%s' % (record['type'], record['name']),
             name=record['name'],
             type=self._string_to_record_type(record['type']),
-            data=record['value'],
+            data=value,
             zone=zone,
             driver=self,
             ttl=record['ttl'],
-            extra={'ttl': record['ttl']}
-        )
+            extra=extras
 
     def _to_records(self, records, zone):
         retval = []

Reply via email to