Make sure "ttl" and "priority" are integers.

Closes #718


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

Branch: refs/heads/trunk
Commit: 29296923046b4cecea200ee5aa3fb9e51f20ce77
Parents: 1d0b2ee
Author: Tomaz Muraus <to...@apache.org>
Authored: Tue Mar 1 15:59:30 2016 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Tue Mar 1 16:01:19 2016 +0100

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


http://git-wip-us.apache.org/repos/asf/libcloud/blob/29296923/libcloud/dns/drivers/gandi.py
----------------------------------------------------------------------
diff --git a/libcloud/dns/drivers/gandi.py b/libcloud/dns/drivers/gandi.py
index 39a21e3..2014034 100644
--- a/libcloud/dns/drivers/gandi.py
+++ b/libcloud/dns/drivers/gandi.py
@@ -147,14 +147,15 @@ class GandiDNSDriver(BaseGandiDriver, DNSDriver):
         return res.object
 
     def _to_record(self, record, zone):
-        extra = {'ttl': record['ttl']}
+        extra = {'ttl': int(record['ttl'])}
         value = record['value']
         if record['type'] == 'MX':
             # Record is in the following form:
             # <priority> <value>
             # e.g. 15 aspmx.l.google.com
-            extra['priority'] = record['value'].split(' ')[0]
-            value = record['value'].split(' ')[1]
+            split = record['value'].split(' ')
+            extra['priority'] = int(split[0])
+            value = split[1]
         return Record(
             id='%s:%s' % (record['type'], record['name']),
             name=record['name'],

Reply via email to