cloudstack: cs_template: fix state=extracted
* url arg is optional but we enforced it * url is in a required together, but args only relevant while registering
This commit is contained in:
parent
0b9c8213ad
commit
1d0df46475
1 changed files with 7 additions and 9 deletions
|
@ -470,6 +470,12 @@ class AnsibleCloudStackTemplate(AnsibleCloudStack):
|
|||
|
||||
|
||||
def register_template(self):
|
||||
required_params = [
|
||||
'format',
|
||||
'url',
|
||||
'hypervisor',
|
||||
]
|
||||
self.module.fail_on_missing_params(required_params=required_params)
|
||||
template = self.get_template()
|
||||
if not template:
|
||||
self.result['changed'] = True
|
||||
|
@ -537,9 +543,6 @@ class AnsibleCloudStackTemplate(AnsibleCloudStack):
|
|||
args['mode'] = self.module.params.get('mode')
|
||||
args['zoneid'] = self.get_zone(key='id')
|
||||
|
||||
if not args['url']:
|
||||
self.module.fail_json(msg="Missing required arguments: url")
|
||||
|
||||
self.result['changed'] = True
|
||||
|
||||
if not self.module.check_mode:
|
||||
|
@ -613,14 +616,9 @@ def main():
|
|||
poll_async = dict(type='bool', default=True),
|
||||
))
|
||||
|
||||
required_together = cs_required_together()
|
||||
required_together.extend([
|
||||
['format', 'url', 'hypervisor'],
|
||||
])
|
||||
|
||||
module = AnsibleModule(
|
||||
argument_spec=argument_spec,
|
||||
required_together=required_together,
|
||||
required_together=cs_required_together(),
|
||||
mutually_exclusive = (
|
||||
['url', 'vm'],
|
||||
['zone', 'cross_zones'],
|
||||
|
|
Loading…
Reference in a new issue