Merge "Add wait method for the Neutron API"
This commit is contained in:
commit
91666e5937
@ -273,3 +273,20 @@ def retry_on_assert_fail(max_retries,
|
||||
raise AssertionError(f"Assert failed after {max_retries} retries.")
|
||||
return inner
|
||||
return decor
|
||||
|
||||
|
||||
def wait_for_neutron_api(neutron_client, timeout=100):
|
||||
"""Waits until the Neutron API replies
|
||||
|
||||
:param neutron_client: a Neutron client; it could have or not admin
|
||||
permissions.
|
||||
:param timeout: maximum time (in seconds) to wait for the Neutron API.
|
||||
"""
|
||||
def _list_agents():
|
||||
try:
|
||||
neutron_client.list_extensions()
|
||||
return True
|
||||
except exceptions.RestClientException:
|
||||
return False
|
||||
|
||||
common_utils.wait_until_true(_list_agents, timeout=timeout, sleep=1)
|
||||
|
Loading…
Reference in New Issue
Block a user