From a760299170820d6ff02374ba54ff04042e375f05 Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Thu, 5 Jun 2014 16:44:55 -0500 Subject: [PATCH] Catch failed connection due to a bad region in ec2_scaling_policy Fixes #7506 --- library/cloud/ec2_scaling_policy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/library/cloud/ec2_scaling_policy b/library/cloud/ec2_scaling_policy index 4e66f463063..6efc1c1bd81 100755 --- a/library/cloud/ec2_scaling_policy +++ b/library/cloud/ec2_scaling_policy @@ -162,6 +162,8 @@ def main(): try: connection = connect_to_aws(boto.ec2.autoscale, region, **aws_connect_params) + if not connection: + module.fail_json(msg="failed to connect to AWS for the given region: %s" % str(region)) except boto.exception.NoAuthHandlerFound, e: module.fail_json(msg = str(e))