Ignore flavor and image find errors on server show
If there is an error finding an image or a flavor during image show, ignore it and just print the id of the flavor or image. This code is also used during server create and server rebuild, but only to display the results. Change-Id: I5362158ab8ffc3e5a0800904d6ea15420c3a8627 Closes-bug: #1489901
This commit is contained in:
parent
f14251669f
commit
5171a427ac
@ -107,14 +107,20 @@ def _prep_server_detail(compute_client, server):
|
||||
image_info = info.get('image', {})
|
||||
if image_info:
|
||||
image_id = image_info.get('id', '')
|
||||
image = utils.find_resource(compute_client.images, image_id)
|
||||
info['image'] = "%s (%s)" % (image.name, image_id)
|
||||
try:
|
||||
image = utils.find_resource(compute_client.images, image_id)
|
||||
info['image'] = "%s (%s)" % (image.name, image_id)
|
||||
except Exception:
|
||||
info['image'] = image_id
|
||||
|
||||
# Convert the flavor blob to a name
|
||||
flavor_info = info.get('flavor', {})
|
||||
flavor_id = flavor_info.get('id', '')
|
||||
flavor = utils.find_resource(compute_client.flavors, flavor_id)
|
||||
info['flavor'] = "%s (%s)" % (flavor.name, flavor_id)
|
||||
try:
|
||||
flavor = utils.find_resource(compute_client.flavors, flavor_id)
|
||||
info['flavor'] = "%s (%s)" % (flavor.name, flavor_id)
|
||||
except Exception:
|
||||
info['flavor'] = flavor_id
|
||||
|
||||
# NOTE(dtroyer): novaclient splits these into separate entries...
|
||||
# Format addresses in a useful way
|
||||
|
Loading…
x
Reference in New Issue
Block a user