Skip to content

Commit

Permalink
catch ImportError rather than Exception when testing Boto3 imports (#267
Browse files Browse the repository at this point in the history
)
  • Loading branch information
tremble authored Oct 19, 2020
1 parent 6eab8b0 commit e83d579
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 16 deletions.
5 changes: 2 additions & 3 deletions plugins/modules/aws_direct_connect_confirm_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,8 @@

try:
from botocore.exceptions import BotoCoreError, ClientError
except Exception:
pass
# handled by imported AnsibleAWSModule
except ImportError:
pass # handled by imported AnsibleAWSModule

retry_params = {"tries": 10, "delay": 5, "backoff": 1.2, "catch_extra_error_codes": ["DirectConnectClientException"]}

Expand Down
5 changes: 2 additions & 3 deletions plugins/modules/aws_direct_connect_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

retry_params = {"tries": 10, "delay": 5, "backoff": 1.2, "catch_extra_error_codes": ["DirectConnectClientException"]}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@

try:
import botocore
except Exception:
except ImportError:
pass # Handled by AnsibleAWSModule

from ansible_collections.amazon.aws.plugins.module_utils.core import AnsibleAWSModule
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/aws_s3_cors.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@

try:
from botocore.exceptions import ClientError, BotoCoreError
except Exception:
except ImportError:
pass # Handled by AnsibleAWSModule

from ansible_collections.amazon.aws.plugins.module_utils.core import AnsibleAWSModule
Expand Down
5 changes: 2 additions & 3 deletions plugins/modules/ec2_transit_gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,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 time import sleep, time
Expand Down
5 changes: 2 additions & 3 deletions plugins/modules/ec2_transit_gateway_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/lambda_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@

try:
from botocore.exceptions import ClientError
except Exception:
except ImportError:
pass # caught by AnsibleAWSModule


Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/rds_snapshot_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@

try:
import botocore
except Exception:
except ImportError:
pass # caught by AnsibleAWSModule


Expand Down

0 comments on commit e83d579

Please sign in to comment.