Fix connection creation to allow usage of profiles with boto
This commit is contained in:
parent
f422782180
commit
543cb13f42
1 changed files with 3 additions and 5 deletions
|
@ -133,6 +133,7 @@ import urllib
|
||||||
try:
|
try:
|
||||||
import boto
|
import boto
|
||||||
import boto.iam
|
import boto.iam
|
||||||
|
import boto.ec2
|
||||||
HAS_BOTO = True
|
HAS_BOTO = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_BOTO = False
|
HAS_BOTO = False
|
||||||
|
@ -321,13 +322,10 @@ def main():
|
||||||
else:
|
else:
|
||||||
pdoc=None
|
pdoc=None
|
||||||
|
|
||||||
ec2_url, aws_access_key, aws_secret_key, region = get_ec2_creds(module)
|
region, ec2_url, aws_connect_kwargs = get_aws_connection_info(module)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
iam = boto.iam.connection.IAMConnection(
|
iam = boto.iam.connection.IAMConnection(**aws_connect_kwargs)
|
||||||
aws_access_key_id=aws_access_key,
|
|
||||||
aws_secret_access_key=aws_secret_key,
|
|
||||||
)
|
|
||||||
except boto.exception.NoAuthHandlerFound, e:
|
except boto.exception.NoAuthHandlerFound, e:
|
||||||
module.fail_json(msg=str(e))
|
module.fail_json(msg=str(e))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue