cloudstack: cs_iso: fix async poll for state=absent (#20050)
This commit is contained in:
parent
3c4623d68b
commit
bcf9cd1e2a
1 changed files with 14 additions and 0 deletions
|
@ -109,6 +109,12 @@ options:
|
||||||
required: false
|
required: false
|
||||||
default: 'present'
|
default: 'present'
|
||||||
choices: [ 'present', 'absent' ]
|
choices: [ 'present', 'absent' ]
|
||||||
|
poll_async:
|
||||||
|
description:
|
||||||
|
- Poll async jobs until job has finished.
|
||||||
|
required: false
|
||||||
|
default: true
|
||||||
|
version_added: "2.3"
|
||||||
extends_documentation_fragment: cloudstack
|
extends_documentation_fragment: cloudstack
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
@ -244,6 +250,8 @@ class AnsibleCloudStackIso(AnsibleCloudStack):
|
||||||
self.result['changed'] = True
|
self.result['changed'] = True
|
||||||
if not self.module.check_mode:
|
if not self.module.check_mode:
|
||||||
res = self.cs.registerIso(**args)
|
res = self.cs.registerIso(**args)
|
||||||
|
if 'errortext' in res:
|
||||||
|
self.module.fail_json(msg="Failed: '%s'" % res['errortext'])
|
||||||
iso = res['iso'][0]
|
iso = res['iso'][0]
|
||||||
return iso
|
return iso
|
||||||
|
|
||||||
|
@ -288,6 +296,11 @@ class AnsibleCloudStackIso(AnsibleCloudStack):
|
||||||
|
|
||||||
if not self.module.check_mode:
|
if not self.module.check_mode:
|
||||||
res = self.cs.deleteIso(**args)
|
res = self.cs.deleteIso(**args)
|
||||||
|
if 'errortext' in res:
|
||||||
|
self.module.fail_json(msg="Failed: '%s'" % res['errortext'])
|
||||||
|
poll_async = self.module.params.get('poll_async')
|
||||||
|
if poll_async:
|
||||||
|
self.poll_job(res, 'iso')
|
||||||
return iso
|
return iso
|
||||||
|
|
||||||
|
|
||||||
|
@ -309,6 +322,7 @@ def main():
|
||||||
is_featured = dict(type='bool', default=False),
|
is_featured = dict(type='bool', default=False),
|
||||||
is_dynamically_scalable = dict(type='bool', default=False),
|
is_dynamically_scalable = dict(type='bool', default=False),
|
||||||
state = dict(choices=['present', 'absent'], default='present'),
|
state = dict(choices=['present', 'absent'], default='present'),
|
||||||
|
poll_async = dict(type='bool', default=True),
|
||||||
))
|
))
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
|
|
Loading…
Reference in a new issue