Hi Roman, Thanks for your patch. I have applied it.
In the future, you may also open a JIRA issue at https://issues.apache.org/jira/browse/LIBCLOUD. Cheers, Jerry On May 7, 2010, at 4:46 AM, Roman Bogorodskiy wrote: > 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
