cloudstack: cs_template: fix state=absent must not need vm, url
only for state=present, fixes example.
This commit is contained in:
parent
5a134d406b
commit
41315b2cd9
1 changed files with 4 additions and 6 deletions
|
@ -596,9 +596,6 @@ def main():
|
||||||
['api_key', 'api_secret', 'api_url'],
|
['api_key', 'api_secret', 'api_url'],
|
||||||
['format', 'url', 'hypervisor'],
|
['format', 'url', 'hypervisor'],
|
||||||
),
|
),
|
||||||
required_one_of = (
|
|
||||||
['url', 'vm'],
|
|
||||||
),
|
|
||||||
supports_check_mode=True
|
supports_check_mode=True
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -612,11 +609,12 @@ def main():
|
||||||
if state in ['absent']:
|
if state in ['absent']:
|
||||||
tpl = acs_tpl.remove_template()
|
tpl = acs_tpl.remove_template()
|
||||||
else:
|
else:
|
||||||
url = module.params.get('url')
|
if module.params.get('url'):
|
||||||
if url:
|
|
||||||
tpl = acs_tpl.register_template()
|
tpl = acs_tpl.register_template()
|
||||||
else:
|
elif module.params.get('vm'):
|
||||||
tpl = acs_tpl.create_template()
|
tpl = acs_tpl.create_template()
|
||||||
|
else:
|
||||||
|
module.fail_json(msg="one of the following is required on state=present: url,vm")
|
||||||
|
|
||||||
result = acs_tpl.get_result(tpl)
|
result = acs_tpl.get_result(tpl)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue