[LIBCLOUD-455] Don't throw if 'imageId' attribute is not present in the
list_nodes response.

Signed-off-by: Tomaz Muraus <[email protected]>


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

Branch: refs/heads/trunk
Commit: 991d8f113abed61b9a7b06bcdb5d92ac64962d4a
Parents: a59142e
Author: Dustin Spicuzza <[email protected]>
Authored: Thu Dec 5 18:48:49 2013 -0500
Committer: Tomaz Muraus <[email protected]>
Committed: Fri Dec 6 18:38:56 2013 +0100

----------------------------------------------------------------------
 libcloud/compute/drivers/openstack.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/991d8f11/libcloud/compute/drivers/openstack.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/openstack.py 
b/libcloud/compute/drivers/openstack.py
index eb6a982..00debd0 100644
--- a/libcloud/compute/drivers/openstack.py
+++ b/libcloud/compute/drivers/openstack.py
@@ -1875,7 +1875,8 @@ class OpenStack_1_1_NodeDriver(OpenStackNodeDriver):
                 # Docs says "tenantId", but actual is "tenant_id". *sigh*
                 # Best handle both.
                 tenantId=api_node.get('tenant_id') or api_node['tenantId'],
-                imageId=api_node['image']['id'],
+                # sometimes the image is not set if openstack is in an error 
state
+                imageId=api_node.get('image', {}).get('id', None),
                 flavorId=api_node['flavor']['id'],
                 uri=next(link['href'] for link in api_node['links'] if
                          link['rel'] == 'self'),

Reply via email to