From 9cb05a084535fdc7f49df774514e2e9207ebee01 Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Thu, 5 Jun 2014 19:40:21 -0500 Subject: [PATCH] Catch failed connection due to a bad region in ec2_scaling_policy Fixes #7505 --- library/cloud/ec2_asg | 2 ++ 1 file changed, 2 insertions(+) diff --git a/library/cloud/ec2_asg b/library/cloud/ec2_asg index 4e7fd1ff7a..5c2faa355c 100644 --- a/library/cloud/ec2_asg +++ b/library/cloud/ec2_asg @@ -216,6 +216,8 @@ def main(): region, ec2_url, aws_connect_params = get_aws_connection_info(module) 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))