Fix waiters to raise on resources going to ERROR
A previous patch[1] updated the wait_for_zone_404 to raise an execption when the zone goes to ERROR. This patch updates the rest of the waiters to also abort waiting if the resource goes into the ERROR status. [1] https://review.opendev.org/c/openstack/designate-tempest-plugin/+/820075 Change-Id: I5d1e549ccd75fbda518e8851430f58cfa849bd97
This commit is contained in:
parent
61ffae7d16
commit
8e14049951
@ -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
Block a user