From a1559be7786f8f944cb01b4f502c9c54ae2c7baf Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotjagov Date: Tue, 30 Apr 2019 11:11:51 +0300 Subject: [PATCH] Fix KeyError when image was deleted KeyError was raised when volume was created from image and then this image is deleted. THis patch adds additional check to avoid such situations. Change-Id: I85712fd9587d8815d2f3c74227ded9a4f62296f3 --- openstack_dashboard/dashboards/project/instances/views.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/openstack_dashboard/dashboards/project/instances/views.py b/openstack_dashboard/dashboards/project/instances/views.py index 08c968e721..6c070dc2f4 100644 --- a/openstack_dashboard/dashboards/project/instances/views.py +++ b/openstack_dashboard/dashboards/project/instances/views.py @@ -182,7 +182,9 @@ 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"): + if (hasattr(boot_volume, "volume_image_metadata") and + boot_volume.volume_image_metadata['image_id'] in + image_dict): instance.image = image_dict[ boot_volume.volume_image_metadata['image_id'] ]