the check for status.status should happen before trying to log it

otherwise, if status.status is None, status.status.api_status will throw
a TypeError

Closes-Bug: #1287097
Change-Id: I62dafed59dcf8850808b22b8977d346607176403
This commit is contained in:
Ionuț Arțăriși 2014-02-19 14:02:12 +01:00 committed by Ionuț Arțăriși
parent cf5088b55f
commit 7a5051f967
1 changed files with 2 additions and 2 deletions

View File

@ -829,12 +829,12 @@ class Instances(object):
#volumes = find_volumes(server.id)
status = InstanceServiceStatus.find_by(instance_id=db.id)
LOG.info(_("Server api_status(%s)") %
status.status.api_status)
if not status.status: # This should never happen.
LOG.error(_("Server status could not be read for "
"instance id(%s)") % db.id)
continue
LOG.info(_("Server api_status(%s)") %
status.status.api_status)
except exception.ModelNotFoundError:
LOG.error(_("Server status could not be read for "
"instance id(%s)") % db.id)