Merge "Fix waiters to raise on resources going to ERROR"
This commit is contained in:
commit
1cbfc88d67
|
@ -15,7 +15,7 @@
|
|||
|
||||
class InvalidStatusError(Exception):
|
||||
"""
|
||||
Exception raise when an entity changes to an unexpected status.
|
||||
Exception raised when an entity changes to an unexpected status.
|
||||
"""
|
||||
|
||||
def __init__(self, entity, entity_id, status, expected_status=None):
|
||||
|
|
|
@ -73,6 +73,10 @@ def wait_for_zone_status(client, zone_id, status, headers=None):
|
|||
LOG.info('Zone %s reached %s', zone_id, status)
|
||||
return
|
||||
|
||||
if zone['status'] == const.ERROR:
|
||||
raise exceptions.InvalidStatusError('Zone', zone_id,
|
||||
zone['status'])
|
||||
|
||||
if int(time.time()) - start >= client.build_timeout:
|
||||
message = ('Zone %(zone_id)s failed to reach status=%(status)s '
|
||||
'within the required time (%(timeout)s s). Current '
|
||||
|
@ -105,6 +109,10 @@ def wait_for_zone_import_status(client, zone_import_id, status):
|
|||
LOG.info('Zone import %s reached %s', zone_import_id, status)
|
||||
return
|
||||
|
||||
if zone_import['status'] == const.ERROR:
|
||||
raise exceptions.InvalidStatusError('Zone Import', zone_import_id,
|
||||
zone_import['status'])
|
||||
|
||||
if int(time.time()) - start >= client.build_timeout:
|
||||
message = ('Zone import %(zone_import_id)s failed to reach '
|
||||
'status=%(status)s within the required time '
|
||||
|
@ -138,6 +146,10 @@ def wait_for_zone_export_status(client, zone_export_id, status):
|
|||
LOG.info('Zone export %s reached %s', zone_export_id, status)
|
||||
return
|
||||
|
||||
if zone_export['status'] == const.ERROR:
|
||||
raise exceptions.InvalidStatusError('Zone Export', zone_export_id,
|
||||
zone_export['status'])
|
||||
|
||||
if int(time.time()) - start >= client.build_timeout:
|
||||
message = ('Zone export %(zone_export_id)s failed to reach '
|
||||
'status=%(status)s within the required time '
|
||||
|
@ -172,6 +184,10 @@ def wait_for_recordset_status(client, zone_id, recordset_id, status):
|
|||
LOG.info('Recordset %s reached %s', recordset_id, status)
|
||||
return
|
||||
|
||||
if recordset['status'] == const.ERROR:
|
||||
raise exceptions.InvalidStatusError('Recordset', recordset_id,
|
||||
recordset['status'])
|
||||
|
||||
if int(time.time()) - start >= client.build_timeout:
|
||||
message = ('Recordset %(recordset_id)s failed to reach '
|
||||
'status=%(status)s within the required time '
|
||||
|
@ -250,6 +266,10 @@ def wait_for_ptr_status(client, fip_id, status):
|
|||
LOG.info('PTR %s reached %s', fip_id, status)
|
||||
return
|
||||
|
||||
if ptr['status'] == const.ERROR:
|
||||
raise exceptions.InvalidStatusError('PTR', fip_id,
|
||||
ptr['status'])
|
||||
|
||||
if int(time.time()) - start >= client.build_timeout:
|
||||
message = ('PTR for FIP: %(fip_id)s failed to reach '
|
||||
'status=%(status)s within the required time '
|
||||
|
|
Loading…
Reference in New Issue