mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-27 15:11:23 -07:00
Fix Deploy VM from template with id==0. (#48421)
This commit is contained in:
parent
4e2891e38f
commit
f415902d04
1 changed files with 4 additions and 4 deletions
|
@ -1331,20 +1331,20 @@ def main():
|
||||||
template_id = None
|
template_id = None
|
||||||
if requested_template_id or requested_template_name:
|
if requested_template_id or requested_template_name:
|
||||||
template_id = get_template_id(module, client, requested_template_id, requested_template_name)
|
template_id = get_template_id(module, client, requested_template_id, requested_template_name)
|
||||||
if not template_id:
|
if template_id is None:
|
||||||
if requested_template_id:
|
if requested_template_id:
|
||||||
module.fail_json(msg='There is no template with template_id: ' + str(requested_template_id))
|
module.fail_json(msg='There is no template with template_id: ' + str(requested_template_id))
|
||||||
elif requested_template_name:
|
elif requested_template_name:
|
||||||
module.fail_json(msg="There is no template with name: " + requested_template_name)
|
module.fail_json(msg="There is no template with name: " + requested_template_name)
|
||||||
|
|
||||||
if exact_count and not template_id:
|
if exact_count and template_id is None:
|
||||||
module.fail_json(msg='Option `exact_count` needs template_id or template_name')
|
module.fail_json(msg='Option `exact_count` needs template_id or template_name')
|
||||||
|
|
||||||
if exact_count is not None and not (count_attributes or count_labels):
|
if exact_count is not None and not (count_attributes or count_labels):
|
||||||
module.fail_json(msg='Either `count_attributes` or `count_labels` has to be specified with option `exact_count`.')
|
module.fail_json(msg='Either `count_attributes` or `count_labels` has to be specified with option `exact_count`.')
|
||||||
if (count_attributes or count_labels) and exact_count is None:
|
if (count_attributes or count_labels) and exact_count is None:
|
||||||
module.fail_json(msg='Option `exact_count` has to be specified when either `count_attributes` or `count_labels` is used.')
|
module.fail_json(msg='Option `exact_count` has to be specified when either `count_attributes` or `count_labels` is used.')
|
||||||
if template_id and state != 'present':
|
if template_id is not None and state != 'present':
|
||||||
module.fail_json(msg="Only state 'present' is valid for the template")
|
module.fail_json(msg="Only state 'present' is valid for the template")
|
||||||
|
|
||||||
if memory:
|
if memory:
|
||||||
|
@ -1372,7 +1372,7 @@ def main():
|
||||||
count_attributes, labels, count_labels, disk_size,
|
count_attributes, labels, count_labels, disk_size,
|
||||||
networks, hard, wait, wait_timeout)
|
networks, hard, wait, wait_timeout)
|
||||||
vms = tagged_instances_list
|
vms = tagged_instances_list
|
||||||
elif template_id and state == 'present':
|
elif template_id is not None and state == 'present':
|
||||||
# Deploy count VMs
|
# Deploy count VMs
|
||||||
changed, instances_list, tagged_instances_list = create_count_of_vms(module, client, template_id, count,
|
changed, instances_list, tagged_instances_list = create_count_of_vms(module, client, template_id, count,
|
||||||
attributes, labels, disk_size, networks, wait, wait_timeout)
|
attributes, labels, disk_size, networks, wait, wait_timeout)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue