diff options
author | Rowan Wookey <admin@rwky.net> | 2015-03-16 17:53:35 +0000 |
---|---|---|
committer | Rowan Wookey <admin@rwky.net> | 2015-03-16 17:53:35 +0000 |
commit | fe5d90f27f5a8af84304324a89e21552d82abfdb (patch) | |
tree | 83e62358882e6d80b16f308596f6f010b050185b | |
parent | b0d194ea94051df0dd4e60ccaaceee1ee7ef5422 (diff) | |
download | ansible-modules-core-fe5d90f27f5a8af84304324a89e21552d82abfdb.tar.gz |
Fixes #542 error when ec2_asg arguments aren't specified
If max_size/min_size/desired_capacity are omitted
when updating an autoscaling group use the existing values
-rw-r--r-- | cloud/amazon/ec2_asg.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/cloud/amazon/ec2_asg.py b/cloud/amazon/ec2_asg.py index 6e5d3508..9c98b282 100644 --- a/cloud/amazon/ec2_asg.py +++ b/cloud/amazon/ec2_asg.py @@ -47,15 +47,15 @@ options: required: false min_size: description: - - Minimum number of instances in group + - Minimum number of instances in group, if unspecified then the current group value will be used. required: false max_size: description: - - Maximum number of instances in group + - Maximum number of instances in group, if unspecified then the current group value will be used. required: false desired_capacity: description: - - Desired number of instances in group + - Desired number of instances in group, if unspecified then the current group value will be used. required: false replace_all_instances: description: @@ -449,6 +449,13 @@ def replace(connection, module): changed = False return(changed, props) + #check if min_size/max_size/desired capacity have been specified and if not use ASG values + if min_size is None: + min_size = as_group.min_size + if max_size is None: + max_size = as_group.max_size + if desired_capacity is None: + desired_capacity = as_group.desired_capacity # set temporary settings and wait for them to be reached as_group.max_size = max_size + batch_size as_group.min_size = min_size + batch_size |