1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

ec2_vpc - Fail module using fail_json on boto import failure.

This commit is contained in:
Robert Estelle 2014-12-01 13:45:50 -05:00 committed by Matt Clay
parent 504e1773ef
commit 2325bae599

View file

@ -145,15 +145,17 @@ EXAMPLES = '''
'''
import sys
import sys # noqa
try:
import boto.ec2
import boto.vpc
from boto.exception import EC2ResponseError
HAS_BOTO = True
except ImportError:
print "failed=True msg='boto required for this module'"
sys.exit(1)
HAS_BOTO = False
if __name__ != '__main__':
raise
class AnsibleRouteTableException(Exception):
@ -432,6 +434,8 @@ def main():
argument_spec=argument_spec,
supports_check_mode=True,
)
if not HAS_BOTO:
module.fail_json(msg='boto is required for this module')
ec2_url, aws_access_key, aws_secret_key, region = get_ec2_creds(module)
if not region: