From 54e51bb900b8bc6396020b155c1d8f9a4acb91e8 Mon Sep 17 00:00:00 2001 From: Mark Chappell Date: Mon, 19 Oct 2020 19:59:22 +0200 Subject: [PATCH] catch ImportError rather than Exception when testing Boto3 imports (#267) This commit was initially merged in https://github.com/ansible-collections/community.aws See: https://github.com/ansible-collections/community.aws/commit/e83d579f5667911a496275eae9c5c7b7da98391e --- plugins/modules/ec2_transit_gateway_info.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/plugins/modules/ec2_transit_gateway_info.py b/plugins/modules/ec2_transit_gateway_info.py index 676862185b4..2eacf01cd96 100644 --- a/plugins/modules/ec2_transit_gateway_info.py +++ b/plugins/modules/ec2_transit_gateway_info.py @@ -166,9 +166,8 @@ try: from botocore.exceptions import BotoCoreError, ClientError -except Exception: - pass - # handled by imported AnsibleAWSModule +except ImportError: + pass # handled by imported AnsibleAWSModule from ansible_collections.amazon.aws.plugins.module_utils.core import AnsibleAWSModule from ansible_collections.amazon.aws.plugins.module_utils.ec2 import (