1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

ec2 module fails when state is not absent

tagged_instances is initialised in a scope not visible
when state is not absent.
This commit is contained in:
Will Thames 2014-02-13 19:51:33 +10:00
parent 6f405c8970
commit c8127ea874

View file

@ -1045,6 +1045,7 @@ def main():
ec2 = ec2_connect(module) ec2 = ec2_connect(module)
tagged_instances = []
if module.params.get('state') == 'absent': if module.params.get('state') == 'absent':
instance_ids = module.params.get('instance_ids') instance_ids = module.params.get('instance_ids')
if not isinstance(instance_ids, list): if not isinstance(instance_ids, list):
@ -1064,7 +1065,6 @@ def main():
if not module.params.get('image'): if not module.params.get('image'):
module.fail_json(msg='image parameter is required for new instance') module.fail_json(msg='image parameter is required for new instance')
tagged_instances = []
if module.params.get('exact_count'): if module.params.get('exact_count'):
(tagged_instances, instance_dict_array, new_instance_ids, changed) = enforce_count(module, ec2) (tagged_instances, instance_dict_array, new_instance_ids, changed) = enforce_count(module, ec2)
else: else: