From 3217957c7b95e60e04b899c8d513acb9fdab509c Mon Sep 17 00:00:00 2001 From: Mark Chappell Date: Tue, 20 Oct 2020 12:42:11 +0200 Subject: [PATCH] Avoid catching botocore.exceptions.ClientError --- plugins/modules/ec2_asg.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/modules/ec2_asg.py b/plugins/modules/ec2_asg.py index 2d54debffc0..7560984070a 100644 --- a/plugins/modules/ec2_asg.py +++ b/plugins/modules/ec2_asg.py @@ -594,13 +594,13 @@ def describe_launch_templates(connection, launch_template): try: lt = connection.describe_launch_templates(LaunchTemplateIds=[launch_template['launch_template_id']]) return lt - except (botocore.exceptions.ClientError) as e: + except is_boto3_error_code('InvalidLaunchTemplateName.NotFoundException'): module.fail_json(msg="No launch template found matching: %s" % launch_template) else: try: lt = connection.describe_launch_templates(LaunchTemplateNames=[launch_template['launch_template_name']]) return lt - except (botocore.exceptions.ClientError) as e: + except is_boto3_error_code('InvalidLaunchTemplateName.NotFoundException'): module.fail_json(msg="No launch template found matching: %s" % launch_template)