You've already forked community.general
mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-29 07:41:16 +03: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:
@ -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
|
||||
|
Reference in New Issue
Block a user