cloudstack: add error result handling in async job
This commit is contained in:
parent
f5b00084e1
commit
0a26b149fc
1 changed files with 4 additions and 2 deletions
|
@ -185,8 +185,10 @@ class AnsibleCloudStack:
|
|||
if 'jobid' in job:
|
||||
while True:
|
||||
res = self.cs.queryAsyncJobResult(jobid=job['jobid'])
|
||||
if res['jobstatus'] != 0:
|
||||
if 'jobresult' in res and key is not None and key in res['jobresult']:
|
||||
if res['jobstatus'] != 0 and 'jobresult' in res:
|
||||
if 'errortext' in res['jobresult']:
|
||||
self.module.fail_json(msg="Failed: '%s'" % res['jobresult']['errortext'])
|
||||
if key and key in res['jobresult']:
|
||||
job = res['jobresult'][key]
|
||||
break
|
||||
time.sleep(2)
|
||||
|
|
Loading…
Reference in a new issue