simpler conditional
This commit is contained in:
parent
e3a58a883a
commit
9df0662408
1 changed files with 3 additions and 3 deletions
|
@ -144,12 +144,12 @@ def get_aws_connection_info(module, boto3=False):
|
||||||
region = boto.config.get('Boto', 'aws_region')
|
region = boto.config.get('Boto', 'aws_region')
|
||||||
if not region:
|
if not region:
|
||||||
region = boto.config.get('Boto', 'ec2_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.
|
# 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')
|
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")
|
module.fail_json("Boto3 is required for this module. Please install boto3 and try again")
|
||||||
|
|
||||||
if not security_token:
|
if not security_token:
|
||||||
if 'AWS_SECURITY_TOKEN' in os.environ:
|
if 'AWS_SECURITY_TOKEN' in os.environ:
|
||||||
security_token = os.environ['AWS_SECURITY_TOKEN']
|
security_token = os.environ['AWS_SECURITY_TOKEN']
|
||||||
|
|
Loading…
Reference in a new issue