mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-09 18:04:02 -07:00
issue #994: use HAS_BOTO to determine if import was successful: - removed import of sys module. - HAS_BOTO constant to check if import was successful. - trigger a failure when import fails. - removed unnecessary imports.
This commit is contained in:
parent
0a48d54c1c
commit
67f769d9a6
21 changed files with 121 additions and 74 deletions
|
@ -90,10 +90,9 @@ EXAMPLES = '''
|
|||
|
||||
try:
|
||||
import boto.ec2
|
||||
HAS_BOTO = True
|
||||
except ImportError:
|
||||
boto_found = False
|
||||
else:
|
||||
boto_found = True
|
||||
HAS_BOTO = False
|
||||
|
||||
|
||||
wait_timeout = 0
|
||||
|
@ -251,8 +250,8 @@ def main():
|
|||
supports_check_mode=True
|
||||
)
|
||||
|
||||
if not boto_found:
|
||||
module.fail_json(msg="boto is required")
|
||||
if not HAS_BOTO:
|
||||
module.fail_json(msg='boto required for this module')
|
||||
|
||||
ec2 = ec2_connect(module)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue