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:
Rene Moser 2016-04-11 20:02:03 +02:00 committed by Matt Clay
parent 1b99ae4ac1
commit b5e4edd9f9

View file

@ -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', choices=BOOLEANS, 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'],