From 380dbd436977d4b45c28a7467a1d1e7c1233b44e Mon Sep 17 00:00:00 2001 From: Shawn Siefkas Date: Tue, 2 Aug 2016 15:37:01 -0500 Subject: [PATCH] Fix #2526 (#2527) Fail on unhandled exception in ec2_asg rather than raise --- cloud/amazon/ec2_asg.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cloud/amazon/ec2_asg.py b/cloud/amazon/ec2_asg.py index 6dacfb45140..66261fdbbd7 100644 --- a/cloud/amazon/ec2_asg.py +++ b/cloud/amazon/ec2_asg.py @@ -334,8 +334,12 @@ def elb_healthy(asg_connection, elb_connection, module, group_name): # but has not yet show up in the ELB try: lb_instances = elb_connection.describe_instance_health(lb, instances=instances) - except boto.exception.InvalidInstance: - pass + except boto.exception.BotoServerError as e: + if e.error_code == 'InvalidInstance': + return None + + module.fail_json(msg=str(e)) + for i in lb_instances: if i.state == "InService": healthy_instances.append(i.instance_id)