[cloud] ec2_asg: wait for the lifecycle hooks - Fixes #37281 (#37282) (#39767)

* [cloud] ec2_asg: wait for the lifecycle hooks - Fixes #37281 (#37282)

Wait for the lifecycle hooks by matching states `Terminating:Wait` and `Terminating:Proceed` in addition to `Terminating`.

(cherry picked from commit ffd1200948)

* Add changelog fragment
pull/39961/head
Alessandro Arnone 7 years ago committed by Jordan Borean
parent fb26f6107d
commit 2107d91e45

@ -0,0 +1,2 @@
bugfixes:
- ec2_asg - wait for lifecycle hooks to complete (https://github.com/ansible/ansible/issues/37281)

@ -1344,7 +1344,7 @@ def wait_for_term_inst(connection, term_instances):
lifecycle = instance_facts[i]['lifecycle_state']
health = instance_facts[i]['health_status']
module.debug("Instance %s has state of %s,%s" % (i, lifecycle, health))
if lifecycle == 'Terminating' or health == 'Unhealthy':
if lifecycle.startswith('Terminating') or health == 'Unhealthy':
count += 1
time.sleep(10)

Loading…
Cancel
Save