if booted from volume, use string from image

If cloud servers in openstack are booted with a volume as their root
partition, they do not have an image assigned to them, so they won't
have an image id.  In these cases just pass the string from node.image
to the image information about that machine.

Fixes #47766
This commit is contained in:
Daniel Wallace 2018-08-06 12:03:39 -05:00
parent 71f587edd7
commit 4cb1636c4b
No known key found for this signature in database
GPG key ID: 5FA5E5544F010D48

View file

@ -466,7 +466,10 @@ def show_instance(name, conn=None, call=None):
ret['public_ips'] = _get_ips(node, 'public')
ret['floating_ips'] = _get_ips(node, 'floating')
ret['fixed_ips'] = _get_ips(node, 'fixed')
ret['image'] = conn.get_image(node.image.id).name
if isinstance(node.image, six.string_types):
ret['image'] = node.image
else:
ret['image'] = conn.get_image(node.image.id).name
return ret