mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-19 03:10:22 -07:00
Adding while loop to wait for cluster container creation (#4039)
* Adding while loop to wait * Adding changelog fragment * Adding parameter and more docs * Adjusting docs Co-authored-by: Travis Scotto <tscotto@webstaurantstore.com>
This commit is contained in:
parent
5fead8bbde
commit
7aab4497ac
3 changed files with 20 additions and 3 deletions
|
@ -75,11 +75,14 @@ class LXDClient(object):
|
|||
else:
|
||||
raise LXDClientException('URL scheme must be unix: or https:')
|
||||
|
||||
def do(self, method, url, body_json=None, ok_error_codes=None, timeout=None):
|
||||
def do(self, method, url, body_json=None, ok_error_codes=None, timeout=None, wait_for_container=None):
|
||||
resp_json = self._send_request(method, url, body_json=body_json, ok_error_codes=ok_error_codes, timeout=timeout)
|
||||
if resp_json['type'] == 'async':
|
||||
url = '{0}/wait'.format(resp_json['operation'])
|
||||
resp_json = self._send_request('GET', url)
|
||||
if wait_for_container:
|
||||
while resp_json['metadata']['status'] == 'Running':
|
||||
resp_json = self._send_request('GET', url)
|
||||
if resp_json['metadata']['status'] != 'Success':
|
||||
self._raise_err_from_json(resp_json)
|
||||
return resp_json
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue