mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-04 07:24:00 -07:00
* Adding while loop to wait
* Adding changelog fragment
* Adding parameter and more docs
* Adjusting docs
Co-authored-by: Travis Scotto <tscotto@webstaurantstore.com>
(cherry picked from commit 7aab4497ac
)
Co-authored-by: tman5 <10875976+tman5@users.noreply.github.com>
This commit is contained in:
parent
499f4b4066
commit
0169cb8358
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