Fix loop in waiter when error_ok is True
If error_ok=True is passed to wait_for_status and a resource is in 'ERROR' status, the function infinitely loops check_timeout value is now considered in case of ERROR statuses in resources. Story: 2008110 Task: 40826 Change-Id: I9d62b2f4ec55a6fd6cba38d446711c16f03a5ade
This commit is contained in:
parent
a5b6008537
commit
3adefa4a4d
@ -68,7 +68,7 @@ def wait_for_status(show_client, id, status_key, status,
|
||||
LOG.info('{name}\'s status updated to {status}.'.format(
|
||||
name=show_client.__name__, status=status))
|
||||
return object_details
|
||||
elif object_details[status_key] == 'ERROR':
|
||||
elif object_details[status_key] == 'ERROR' and not error_ok:
|
||||
message = ('{name} {field} updated to an invalid state of '
|
||||
'ERROR'.format(name=show_client.__name__,
|
||||
field=status_key))
|
||||
@ -76,9 +76,9 @@ def wait_for_status(show_client, id, status_key, status,
|
||||
if caller:
|
||||
message = '({caller}) {message}'.format(caller=caller,
|
||||
message=message)
|
||||
if not error_ok:
|
||||
raise exceptions.UnexpectedResponseCode(message)
|
||||
elif int(time.time()) - start >= check_timeout:
|
||||
|
||||
if int(time.time()) - start >= check_timeout:
|
||||
message = (
|
||||
'{name} {field} failed to update to {expected_status} within '
|
||||
'the required time {timeout}. Current status of {name}: '
|
||||
|
Loading…
Reference in New Issue
Block a user