diff options
| author | Jenkins <jenkins@review.openstack.org> | 2016-02-04 00:39:47 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2016-02-04 00:39:47 +0000 |
| commit | e4c0d8583dbff3057f144cd6a5c1461ae06dbc67 (patch) | |
| tree | 815586d4e769dad100ff3f05a1e697d528858766 /openstackclient/common/utils.py | |
| parent | 78d51125acf23dc89ed6a2e4803b12326e742c9f (diff) | |
| parent | 5903ffff8a56481e124aa4fe8144c16348f6f8b9 (diff) | |
| download | python-openstackclient-e4c0d8583dbff3057f144cd6a5c1461ae06dbc67.tar.gz | |
Merge "Allow wait_for_delete to work for all clients"
Diffstat (limited to 'openstackclient/common/utils.py')
| -rw-r--r-- | openstackclient/common/utils.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/openstackclient/common/utils.py b/openstackclient/common/utils.py index a468629b..4142f830 100644 --- a/openstackclient/common/utils.py +++ b/openstackclient/common/utils.py @@ -314,6 +314,8 @@ def wait_for_status(status_f, def wait_for_delete(manager, res_id, status_field='status', + error_status=['error'], + exception_name=['NotFound'], sleep_time=5, timeout=300, callback=None): @@ -324,6 +326,8 @@ def wait_for_delete(manager, :param status_field: the status attribute in the returned resource object, this is used to check for error states while the resource is being deleted + :param error_status: a list of status strings for error + :param exception_name: a list of exception strings for deleted case :param sleep_time: wait this long between checks (seconds) :param timeout: check until this long (seconds) :param callback: called per sleep cycle, useful to display progress; this @@ -340,12 +344,12 @@ def wait_for_delete(manager, # handle a NotFound exception here without parsing the message res = manager.get(res_id) except Exception as ex: - if type(ex).__name__ == 'NotFound': + if type(ex).__name__ in exception_name: return True raise status = getattr(res, status_field, '').lower() - if status == 'error': + if status in error_status: return False if callback: |
