You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2015/06/14 12:52:29 UTC

[18/21] libcloud git commit: DigitalOceanNodeDriver patch - v2 driver referenced object instead of response

DigitalOceanNodeDriver patch - v2 driver referenced object instead of response

Signed-off-by: Tomaz Muraus <to...@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....@gmail.com>
Authored: Thu May 28 15:42:58 2015 +0000
Committer: Tomaz Muraus <to...@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'])