From acdb4c3edecf0703804b24eae177ded014a078c6 Mon Sep 17 00:00:00 2001 From: Jason Witkowski Date: Tue, 12 Mar 2019 21:31:03 -0400 Subject: [PATCH] Fix min_size reference where type is None (#53669) --- changelogs/fragments/53669-ec2_asg_fix_race_condition.yml | 2 ++ lib/ansible/modules/cloud/amazon/ec2_asg.py | 2 ++ 2 files changed, 4 insertions(+) create mode 100644 changelogs/fragments/53669-ec2_asg_fix_race_condition.yml diff --git a/changelogs/fragments/53669-ec2_asg_fix_race_condition.yml b/changelogs/fragments/53669-ec2_asg_fix_race_condition.yml new file mode 100644 index 00000000000..81a5d33e753 --- /dev/null +++ b/changelogs/fragments/53669-ec2_asg_fix_race_condition.yml @@ -0,0 +1,2 @@ +bugfixes: + - ec2_asg - Fix scenario where min_size can end up passing None type to boto diff --git a/lib/ansible/modules/cloud/amazon/ec2_asg.py b/lib/ansible/modules/cloud/amazon/ec2_asg.py index 52987279dec..d973ede1e1e 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_asg.py +++ b/lib/ansible/modules/cloud/amazon/ec2_asg.py @@ -1488,6 +1488,8 @@ def terminate_batch(connection, replace_instances, initial_instances, leftovers= if num_new_inst_needed == 0: decrement_capacity = True if as_group['MinSize'] != min_size: + if min_size is None: + min_size = as_group['MinSize'] updated_params = dict(AutoScalingGroupName=as_group['AutoScalingGroupName'], MinSize=min_size) update_asg(connection, **updated_params) module.debug("Updating minimum size back to original of %s" % min_size)