incubator-libcloud mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roman Bogorodskiy <bogorods...@gmail.com>
Subject [libcloud] GoGrid driver regression?
Date Fri, 07 May 2010 09:46:24 GMT
Hello,

Looks like a regression has been introduced to the gogrid driver by this
commit:

http://github.com/apache/libcloud/commit/e6e37760a07939b1fac993cc8c60dc34d505c79d

The thing is that GoGrid doesn't provide ID for the just created node,
so adding new node fails with the following exception:

  File "/usr/local/lib/python2.6/dist-packages/libcloud/drivers/gogrid.py", line 241, in create_node
    node = self._to_node(object['list'][0])
  File "/usr/local/lib/python2.6/dist-packages/libcloud/drivers/gogrid.py", line 152, in _to_node
    id = self._get_id(element)
  File "/usr/local/lib/python2.6/dist-packages/libcloud/drivers/gogrid.py", line 147, in _get_id
    return element['id']
KeyError: 'id'

After reverting this change with some minor changes:

--- a/libcloud/drivers/gogrid.py
+++ b/libcloud/drivers/gogrid.py
@@ -143,8 +143,8 @@ class GoGridNodeDriver(NodeDriver):
     def _get_ip(self, element):
         return element['ip']['ip']
 
-    def _get_id(self,element):
-        return element['id']
+    def _get_id(self, element):
+        return element.get('id')
 
     def _to_node(self, element):
         state = self._get_state(element)

It started to work fine.

Copy of the diff: 

http://people.freebsd.org/~novel/misc/libcloud_gogrid_id.diff

Roman Bogorodskiy

Mime
View raw message