From d1d96b6b504058c9b16752ededd84344af4dd517 Mon Sep 17 00:00:00 2001 From: Benno Joy Date: Thu, 19 Jun 2014 08:08:18 +0000 Subject: [PATCH] return properties of the newly created scaling policy --- library/cloud/ec2_scaling_policy | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/library/cloud/ec2_scaling_policy b/library/cloud/ec2_scaling_policy index 6efc1c1bd8..ddb0fed4fa 100755 --- a/library/cloud/ec2_scaling_policy +++ b/library/cloud/ec2_scaling_policy @@ -91,7 +91,8 @@ def create_scaling_policy(connection, module): try: connection.create_scaling_policy(sp) - module.exit_json(changed=True) + policy = connection.get_all_policies(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) except BotoServerError, e: module.fail_json(msg=str(e)) else: @@ -118,7 +119,8 @@ def create_scaling_policy(connection, module): connection.create_scaling_policy(policy) policy = connection.get_all_policies(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) + policy = connection.get_all_policies(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) except BotoServerError, e: module.fail_json(msg=str(e))