Fix AttributeError in the project instance detail view

The previous code does not handle a case where admin-specific attributes
do not exist. This leads to AttributeError in the project instance detail
page as these attributes are not included in the response from nova API.

Change-Id: I4c2942960259782d47c6777394dec6888959e26c
Closes-Bug: #1905024
This commit is contained in:
Akihiro Motoki 2020-11-20 20:57:28 +09:00
parent d6ab5431ba
commit a20a275ef5
1 changed files with 1 additions and 1 deletions

View File

@ -84,7 +84,7 @@ class Server(base.APIResourceWrapper):
@property
def has_extended_attrs(self):
return any(getattr(self, attr) for attr in [
return any(getattr(self, attr, None) for attr in [
'OS-EXT-SRV-ATTR:instance_name', 'OS-EXT-SRV-ATTR:host',
'OS-EXT-SRV-ATTR:hostname', 'OS-EXT-SRV-ATTR:kernel_id',
'OS-EXT-SRV-ATTR:ramdisk_id', 'OS-EXT-SRV-ATTR:root_device_name',