summaryrefslogtreecommitdiff
path: root/openstack_dashboard/dashboards/project/instances/views.py
diff options
context:
space:
mode:
authorAkihiro Motoki <amotoki@gmail.com>2019-07-02 14:05:19 +0900
committerVishal Manchanda <manchandavishal143@gmail.com>2019-07-29 18:18:56 +0000
commit42f4ef334d89a492103fdea2df982e108d5713ea (patch)
treee5ac40f7a06bf571f3d26664c415bc74387a4912 /openstack_dashboard/dashboards/project/instances/views.py
parent82a20c670a54554571a92a0c4663f29dcfbbacbf (diff)
downloadhorizon-42f4ef334d89a492103fdea2df982e108d5713ea.tar.gz
Do not always assume image_id in volume_image_metadata
volume_image_metadata can contain only fields other than image_id. We should not assume volume_image_metadata always contain image_id when volume_image_metadata exists. Change-Id: I0db8a05e488eb6bf276760d5116d05633c882701 Closes-Bug: #1834747
Diffstat (limited to 'openstack_dashboard/dashboards/project/instances/views.py')
-rw-r--r--openstack_dashboard/dashboards/project/instances/views.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/openstack_dashboard/dashboards/project/instances/views.py b/openstack_dashboard/dashboards/project/instances/views.py
index 61dcab037..df00241ea 100644
--- a/openstack_dashboard/dashboards/project/instances/views.py
+++ b/openstack_dashboard/dashboards/project/instances/views.py
@@ -210,8 +210,12 @@ class IndexView(tables.PagedTableMixin, tables.DataTableView):
# Getting volume object, which is as attached
# as the first device
boot_volume = volume_dict[instance_volumes[0]['id']]
- if hasattr(boot_volume, "volume_image_metadata"):
- image_id = boot_volume.volume_image_metadata['image_id']
+ # There is a case where volume_image_metadata contains
+ # only fields other than 'image_id' (See bug 1834747),
+ # so we try to populate image information only when it is found.
+ volume_metadata = getattr(boot_volume, "volume_image_metadata", {})
+ image_id = volume_metadata.get('image_id')
+ if image_id:
try:
instance.image = image_dict[image_id]
except KeyError: