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

fixe issue #600, where ec2 module returns instance state as runing even after instance is terminated

This commit is contained in:
Benno Joy 2015-05-14 08:29:11 +05:30 committed by Matt Clay
parent 6f2f07ef51
commit d24fbf5c3e

View file

@ -1089,6 +1089,13 @@ def terminate_instances(module, ec2, instance_ids):
# waiting took too long
if wait_timeout < time.time() and num_terminated < len(terminated_instance_ids):
module.fail_json(msg = "wait for instance termination timeout on %s" % time.asctime())
#Lets get the current state of the instances after terminating - issue600
instance_dict_array = []
for res in ec2.get_all_instances(instance_ids=terminated_instance_ids,\
filters={'instance-state-name':'terminated'}):
for inst in res.instances:
instance_dict_array.append(get_instance_info(inst))
return (changed, instance_dict_array, terminated_instance_ids)