Following fixes were done: Only MX and SRV records have pririoty. Content-type 
for data has to be json. data param of connection request must be string, 
changed that.   Closes #775   Closes #736   Closes #736


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

Branch: refs/heads/trunk
Commit: e633ce4362e568477187a1e3cc07441c4ea011d7
Parents: 5c09af2
Author: Teemu Vesala <teemu.ves...@qentinel.com>
Authored: Mon Apr 25 07:00:30 2016 +0000
Committer: anthony-shaw <anthonys...@apache.org>
Committed: Sun May 1 18:22:50 2016 -0700

----------------------------------------------------------------------
 libcloud/dns/drivers/godaddy.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/e633ce43/libcloud/dns/drivers/godaddy.py
----------------------------------------------------------------------
diff --git a/libcloud/dns/drivers/godaddy.py b/libcloud/dns/drivers/godaddy.py
index 62c21d6..21cd2b8 100644
--- a/libcloud/dns/drivers/godaddy.py
+++ b/libcloud/dns/drivers/godaddy.py
@@ -89,6 +89,7 @@ class GoDaddyDNSConnection(ConnectionKey):
     def add_default_headers(self, headers):
         if self.shopper_id is not None:
             headers['X-Shopper-Id'] = self.shopper_id
+        headers['Content-type'] = 'application/json'
         headers['Authorization'] = "sso-key %s:%s" % \
             (self.key, self.secret)
         return headers
@@ -189,7 +190,7 @@ class GoDaddyDNSDriver(DNSDriver):
         new_record = self._format_record(name, type, data, extra)
         self.connection.request(
             '/v1/domains/%s/records' % (zone.domain), method='PATCH',
-            data=[new_record])
+            data=json.dumps([new_record]))
         id = self._get_id_of_record(name, type)
         return Record(
             id=id, name=name,
@@ -228,7 +229,7 @@ class GoDaddyDNSDriver(DNSDriver):
                                               record.type,
                                               record.name),
             method='PUT',
-            data=[new_record])
+            data=json.dumps([new_record]))
         id = self._get_id_of_record(name, type)
         return Record(
             id=id, name=name,
@@ -420,9 +421,10 @@ class GoDaddyDNSDriver(DNSDriver):
                 'type': type,
                 'name': name,
                 'data': data,
-                'priority': 1,
                 'ttl': extra.get('ttl', 5)
             }
+        if type == RecordType.MX:
+            new_record['priority'] = 1
         return new_record
 
     def _to_zones(self, items):

Reply via email to