Skip to content

Commit 5171a42

Browse files
committed
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
1 parent f142516 commit 5171a42

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

openstackclient/compute/v2/server.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,20 @@ def _prep_server_detail(compute_client, server):
107107
image_info = info.get('image', {})
108108
if image_info:
109109
image_id = image_info.get('id', '')
110-
image = utils.find_resource(compute_client.images, image_id)
111-
info['image'] = "%s (%s)" % (image.name, image_id)
110+
try:
111+
image = utils.find_resource(compute_client.images, image_id)
112+
info['image'] = "%s (%s)" % (image.name, image_id)
113+
except Exception:
114+
info['image'] = image_id
112115

113116
# Convert the flavor blob to a name
114117
flavor_info = info.get('flavor', {})
115118
flavor_id = flavor_info.get('id', '')
116-
flavor = utils.find_resource(compute_client.flavors, flavor_id)
117-
info['flavor'] = "%s (%s)" % (flavor.name, flavor_id)
119+
try:
120+
flavor = utils.find_resource(compute_client.flavors, flavor_id)
121+
info['flavor'] = "%s (%s)" % (flavor.name, flavor_id)
122+
except Exception:
123+
info['flavor'] = flavor_id
118124

119125
# NOTE(dtroyer): novaclient splits these into separate entries...
120126
# Format addresses in a useful way

0 commit comments

Comments
 (0)