Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
8d174e70
Commit
8d174e70
authored
Apr 27, 2015
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updating module_utils/ec2.py in v2 with version from v1
parent
49bf70ed
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
13 deletions
+16
-13
v2/ansible/module_utils/ec2.py
+16
-13
No files found.
v2/ansible/module_utils/ec2.py
View file @
8d174e70
...
...
@@ -33,13 +33,14 @@ except:
HAS_LOOSE_VERSION
=
False
def
aws_common_argument_spec
():
return
dict
(
ec2_url
=
dict
(),
aws_secret_key
=
dict
(
aliases
=
[
'ec2_secret_key'
,
'secret_key'
],
no_log
=
True
),
aws_access_key
=
dict
(
aliases
=
[
'ec2_access_key'
,
'access_key'
]),
validate_certs
=
dict
(
default
=
True
,
type
=
'bool'
),
security_token
=
dict
(
no_log
=
True
),
security_token
=
dict
(
aliases
=
[
'access_token'
],
no_log
=
True
),
profile
=
dict
(),
)
...
...
@@ -72,38 +73,38 @@ def get_aws_connection_info(module):
validate_certs
=
module
.
params
.
get
(
'validate_certs'
)
if
not
ec2_url
:
if
'EC2_URL'
in
os
.
environ
:
ec2_url
=
os
.
environ
[
'EC2_URL'
]
elif
'AWS_URL'
in
os
.
environ
:
if
'AWS_URL'
in
os
.
environ
:
ec2_url
=
os
.
environ
[
'AWS_URL'
]
elif
'EC2_URL'
in
os
.
environ
:
ec2_url
=
os
.
environ
[
'EC2_URL'
]
if
not
access_key
:
if
'EC2_ACCESS_KEY'
in
os
.
environ
:
access_key
=
os
.
environ
[
'EC2_ACCESS_KEY'
]
elif
'AWS_ACCESS_KEY_ID'
in
os
.
environ
:
if
'AWS_ACCESS_KEY_ID'
in
os
.
environ
:
access_key
=
os
.
environ
[
'AWS_ACCESS_KEY_ID'
]
elif
'AWS_ACCESS_KEY'
in
os
.
environ
:
access_key
=
os
.
environ
[
'AWS_ACCESS_KEY'
]
elif
'EC2_ACCESS_KEY'
in
os
.
environ
:
access_key
=
os
.
environ
[
'EC2_ACCESS_KEY'
]
else
:
# in case access_key came in as empty string
access_key
=
None
if
not
secret_key
:
if
'EC2_SECRET_KEY'
in
os
.
environ
:
secret_key
=
os
.
environ
[
'EC2_SECRET_KEY'
]
elif
'AWS_SECRET_ACCESS_KEY'
in
os
.
environ
:
if
'AWS_SECRET_ACCESS_KEY'
in
os
.
environ
:
secret_key
=
os
.
environ
[
'AWS_SECRET_ACCESS_KEY'
]
elif
'AWS_SECRET_KEY'
in
os
.
environ
:
secret_key
=
os
.
environ
[
'AWS_SECRET_KEY'
]
elif
'EC2_SECRET_KEY'
in
os
.
environ
:
secret_key
=
os
.
environ
[
'EC2_SECRET_KEY'
]
else
:
# in case secret_key came in as empty string
secret_key
=
None
if
not
region
:
if
'EC2_REGION'
in
os
.
environ
:
region
=
os
.
environ
[
'EC2_REGION'
]
elif
'AWS_REGION'
in
os
.
environ
:
if
'AWS_REGION'
in
os
.
environ
:
region
=
os
.
environ
[
'AWS_REGION'
]
elif
'EC2_REGION'
in
os
.
environ
:
region
=
os
.
environ
[
'EC2_REGION'
]
else
:
# boto.config.get returns None if config not found
region
=
boto
.
config
.
get
(
'Boto'
,
'aws_region'
)
...
...
@@ -113,6 +114,8 @@ def get_aws_connection_info(module):
if
not
security_token
:
if
'AWS_SECURITY_TOKEN'
in
os
.
environ
:
security_token
=
os
.
environ
[
'AWS_SECURITY_TOKEN'
]
elif
'EC2_SECURITY_TOKEN'
in
os
.
environ
:
security_token
=
os
.
environ
[
'EC2_SECURITY_TOKEN'
]
else
:
# in case security_token came in as empty string
security_token
=
None
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment