mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
fixed bug where scaling policy return a random policy if many autoscale group have policies with same name.
This commit is contained in:
parent
1ddae11bd1
commit
17a409f20d
1 changed files with 2 additions and 2 deletions
|
@ -88,7 +88,7 @@ def create_scaling_policy(connection, module):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
connection.create_scaling_policy(sp)
|
connection.create_scaling_policy(sp)
|
||||||
policy = connection.get_all_policies(policy_names=[sp_name])[0]
|
policy = connection.get_all_policies(as_group=asg_name,policy_names=[sp_name])[0]
|
||||||
module.exit_json(changed=True, name=policy.name, arn=policy.policy_arn, as_name=policy.as_name, scaling_adjustment=policy.scaling_adjustment, cooldown=policy.cooldown, adjustment_type=policy.adjustment_type, min_adjustment_step=policy.min_adjustment_step)
|
module.exit_json(changed=True, name=policy.name, arn=policy.policy_arn, as_name=policy.as_name, scaling_adjustment=policy.scaling_adjustment, cooldown=policy.cooldown, adjustment_type=policy.adjustment_type, min_adjustment_step=policy.min_adjustment_step)
|
||||||
except BotoServerError, e:
|
except BotoServerError, e:
|
||||||
module.fail_json(msg=str(e))
|
module.fail_json(msg=str(e))
|
||||||
|
@ -115,7 +115,7 @@ def create_scaling_policy(connection, module):
|
||||||
try:
|
try:
|
||||||
if changed:
|
if changed:
|
||||||
connection.create_scaling_policy(policy)
|
connection.create_scaling_policy(policy)
|
||||||
policy = connection.get_all_policies(policy_names=[sp_name])[0]
|
policy = connection.get_all_policies(as_group=asg_name,policy_names=[sp_name])[0]
|
||||||
module.exit_json(changed=changed, name=policy.name, arn=policy.policy_arn, as_name=policy.as_name, scaling_adjustment=policy.scaling_adjustment, cooldown=policy.cooldown, adjustment_type=policy.adjustment_type, min_adjustment_step=policy.min_adjustment_step)
|
module.exit_json(changed=changed, name=policy.name, arn=policy.policy_arn, as_name=policy.as_name, scaling_adjustment=policy.scaling_adjustment, cooldown=policy.cooldown, adjustment_type=policy.adjustment_type, min_adjustment_step=policy.min_adjustment_step)
|
||||||
except BotoServerError, e:
|
except BotoServerError, e:
|
||||||
module.fail_json(msg=str(e))
|
module.fail_json(msg=str(e))
|
||||||
|
|
Loading…
Reference in a new issue