diff options
| author | TerryHowe <terrylhowe@gmail.com> | 2015-08-28 09:32:05 -0600 |
|---|---|---|
| committer | TerryHowe <terrylhowe@gmail.com> | 2015-08-28 09:32:05 -0600 |
| commit | 5171a427ac81605182cee55efdcd48da07cb5633 (patch) | |
| tree | beec8e5e3ad2b8e40fe3f3e8750c764001689642 | |
| parent | f14251669f96d6010581702417828f4380144aa2 (diff) | |
| download | python-openstackclient-5171a427ac81605182cee55efdcd48da07cb5633.tar.gz | |
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
| -rw-r--r-- | openstackclient/compute/v2/server.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/openstackclient/compute/v2/server.py b/openstackclient/compute/v2/server.py index 4efef975..6d837d9c 100644 --- a/openstackclient/compute/v2/server.py +++ b/openstackclient/compute/v2/server.py @@ -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 |
