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

ec2_asg: fix desired_capacity not optional (#34194)

1# Please enter the commit message for your changes. Lines starting
This commit is contained in:
René Moser 2018-01-03 15:31:34 +01:00 committed by ansibot
parent a323521e46
commit 798aa8a2d2

View file

@ -1145,6 +1145,9 @@ def replace(connection):
replace_instances = module.params.get('replace_instances')
as_group = describe_autoscaling_groups(connection, group_name)[0]
if desired_capacity is None:
desired_capacity = as_group['DesiredCapacity']
wait_for_new_inst(connection, group_name, wait_timeout, as_group['MinSize'], 'viable_instances')
props = get_properties(as_group)
instances = props['instances']
@ -1178,8 +1181,7 @@ def replace(connection):
min_size = as_group['MinSize']
if max_size is None:
max_size = as_group['MaxSize']
if desired_capacity is None:
desired_capacity = as_group['DesiredCapacity']
# set temporary settings and wait for them to be reached
# This should get overwritten if the number of instances left is less than the batch size.
@ -1265,6 +1267,9 @@ def terminate_batch(connection, replace_instances, initial_instances, leftovers=
break_loop = False
as_group = describe_autoscaling_groups(connection, group_name)[0]
if desired_capacity is None:
desired_capacity = as_group['DesiredCapacity']
props = get_properties(as_group)
desired_size = as_group['MinSize']
@ -1434,5 +1439,6 @@ def main():
changed = True
module.exit_json(changed=changed, **asg_properties)
if __name__ == '__main__':
main()