diff options
author | Brian Coca <brian.coca+git@gmail.com> | 2016-01-25 22:01:48 -0500 |
---|---|---|
committer | Brian Coca <brian.coca+git@gmail.com> | 2016-01-25 22:01:48 -0500 |
commit | 9df06624084f55b1adaff04a93008bb0ae0a3693 (patch) | |
tree | fc7d15c98e36770a9b9037f71bbb714f62d09eff | |
parent | e3a58a883ac90d09c7de2ff94242eed845952904 (diff) | |
download | ansible-9df06624084f55b1adaff04a93008bb0ae0a3693.tar.gz |
simpler conditional
-rw-r--r-- | lib/ansible/module_utils/ec2.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/ansible/module_utils/ec2.py b/lib/ansible/module_utils/ec2.py index 7a30955db8..2263ad86f4 100644 --- a/lib/ansible/module_utils/ec2.py +++ b/lib/ansible/module_utils/ec2.py @@ -144,12 +144,12 @@ def get_aws_connection_info(module, boto3=False): region = boto.config.get('Boto', 'aws_region') if not region: region = boto.config.get('Boto', 'ec2_region') - elif boto3 and HAS_BOTO3: + elif HAS_BOTO3: # here we don't need to make an additional call, will default to 'us-east-1' if the below evaluates to None. region = botocore.session.get_session().get_config_variable('region') - elif boto3 and not HAS_BOTO3: + else: module.fail_json("Boto3 is required for this module. Please install boto3 and try again") - + if not security_token: if 'AWS_SECURITY_TOKEN' in os.environ: security_token = os.environ['AWS_SECURITY_TOKEN'] |