-
-
Save emonty/2a3433c4d536a8403a3b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commit 867b376b78ce9487e3e6ef540630211b2721c373 | |
Author: Monty Taylor <mordred@inaugust.com> | |
Date: Mon Mar 16 09:24:12 2015 -0400 | |
Sometimes clouds have strings for image | |
Cisco OpenStack apparenty has moments where it can return the image info | |
in a string, rather than in a dict/object. Don't know why - but let's | |
handle it. | |
Change-Id: I40c6796ab9d0cb2bc999b0d91313e62f10b1fccf | |
diff --git a/shade/meta.py b/shade/meta.py | |
index 90a60d5..783af28 100644 | |
--- a/shade/meta.py | |
+++ b/shade/meta.py | |
@@ -112,10 +112,15 @@ def get_hostvars_from_server(cloud, server, mounts=None): | |
if flavor_name: | |
server_vars['flavor']['name'] = flavor_name | |
- image_id = server.image['id'] | |
- image_name = cloud.get_image_name(image_id) | |
- if image_name: | |
- server_vars['image']['name'] = image_name | |
+ # Cisco OpenStack can return a raw string here | |
+ if hasattr(server.image, '__getitem__'): | |
+ image_id = server.image.get('id', None) | |
+ else: | |
+ image_id = server.image | |
+ if image_id: | |
+ image_name = cloud.get_image_name(image_id) | |
+ if image_name: | |
+ server_vars['image']['name'] = image_name | |
volumes = [] | |
for vol in cloud.get_volumes(server): |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment