From 7f7c059a0467448cbff81e869879184fbd1da57a Mon Sep 17 00:00:00 2001 From: Ryan Brown Date: Thu, 29 Nov 2018 08:42:55 -0500 Subject: [PATCH] ec2_asg: Retry Autoscaling Group delete calls when scaling activity is in progress (#46124) * Retry delete calls when scaling activity is in progress * changelog --- changelogs/fragments/ec2_asg_retry_deletion_when_busy.yaml | 2 ++ lib/ansible/modules/cloud/amazon/ec2_asg.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/ec2_asg_retry_deletion_when_busy.yaml diff --git a/changelogs/fragments/ec2_asg_retry_deletion_when_busy.yaml b/changelogs/fragments/ec2_asg_retry_deletion_when_busy.yaml new file mode 100644 index 00000000000..c1ce7420783 --- /dev/null +++ b/changelogs/fragments/ec2_asg_retry_deletion_when_busy.yaml @@ -0,0 +1,2 @@ +bugfixes: + - Retry deleting the autoscaling group if there are scaling activities in progress. diff --git a/lib/ansible/modules/cloud/amazon/ec2_asg.py b/lib/ansible/modules/cloud/amazon/ec2_asg.py index 7b88a717d39..45433ba6a64 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_asg.py +++ b/lib/ansible/modules/cloud/amazon/ec2_asg.py @@ -585,7 +585,7 @@ def update_asg(connection, **params): connection.update_auto_scaling_group(**params) -@AWSRetry.backoff(**backoff_params) +@AWSRetry.backoff(catch_extra_error_codes=['ScalingActivityInProgress'], **backoff_params) def delete_asg(connection, asg_name, force_delete): connection.delete_auto_scaling_group(AutoScalingGroupName=asg_name, ForceDelete=force_delete)