Skip to content

Commit

Permalink
Avoid catching botocore.exceptions.ClientError
Browse files Browse the repository at this point in the history
  • Loading branch information
tremble committed Nov 14, 2020
1 parent 401ee3c commit 3217957
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions plugins/modules/ec2_asg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down

0 comments on commit 3217957

Please sign in to comment.