libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject [18/21] libcloud git commit: DigitalOceanNodeDriver patch - v2 driver referenced object instead of response
Date Sun, 14 Jun 2015 10:52:29 GMT
DigitalOceanNodeDriver patch - v2 driver referenced object instead of response

Signed-off-by: Tomaz Muraus <tomaz@tomaz.me>


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

Branch: refs/heads/trunk
Commit: 9baacf602e4066a3c44b22da95f7729436486e17
Parents: fa66763
Author: jcastillo2nd <j.castillo.2nd@gmail.com>
Authored: Thu May 28 15:42:58 2015 +0000
Committer: Tomaz Muraus <tomaz@tomaz.me>
Committed: Sun Jun 14 18:05:58 2015 +0800

----------------------------------------------------------------------
 libcloud/compute/drivers/digitalocean.py | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/9baacf60/libcloud/compute/drivers/digitalocean.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/digitalocean.py b/libcloud/compute/drivers/digitalocean.py
index aa6dba4..69b683d 100644
--- a/libcloud/compute/drivers/digitalocean.py
+++ b/libcloud/compute/drivers/digitalocean.py
@@ -352,14 +352,15 @@ class DigitalOcean_v2_NodeDriver(DigitalOcean_v2_BaseDriver,
         if ex_ssh_key_ids:
             params['ssh_key_ids'] = ','.join(ex_ssh_key_ids)
 
-        data = self.connection.request('/v2/droplets',
-                                       params=params, method='POST').object
+        res = self.connection.request('/v2/droplets',
+                                       params=params, method='POST')
 
+        data = res.object
         # TODO: Handle this in the response class
-        status = data.object.get('status', 'OK')
+        status = res.object.get('status', 'OK')
         if status == 'ERROR':
-            message = data.object.get('message', None)
-            error_message = data.object.get('error_message', message)
+            message = res.object.get('message', None)
+            error_message = res.object.get('error_message', message)
             raise ValueError('Failed to create node: %s' % (error_message))
 
         return self._to_node(data=data['droplet'])


Mime
View raw message