mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-24 07:26:29 +00:00
parent
5d4036d938
commit
dad66e15c0
1 changed files with 11 additions and 3 deletions
|
@ -50,6 +50,8 @@ class GetCredentials(Task):
|
||||||
if all(getattr(provider, provider_key(key)) is not None for key in keys):
|
if all(getattr(provider, provider_key(key)) is not None for key in keys):
|
||||||
for key in keys:
|
for key in keys:
|
||||||
creds[key] = getattr(provider, provider_key(key))
|
creds[key] = getattr(provider, provider_key(key))
|
||||||
|
if hasattr(provider, 'security_token'):
|
||||||
|
creds['security-token'] = provider.security_token
|
||||||
return creds
|
return creds
|
||||||
raise RuntimeError(('No ec2 credentials found, they must all be specified '
|
raise RuntimeError(('No ec2 credentials found, they must all be specified '
|
||||||
'exclusively via environment variables or through the manifest.'))
|
'exclusively via environment variables or through the manifest.'))
|
||||||
|
@ -63,6 +65,12 @@ class Connect(Task):
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls, info):
|
def run(cls, info):
|
||||||
from boto.ec2 import connect_to_region
|
from boto.ec2 import connect_to_region
|
||||||
info._ec2['connection'] = connect_to_region(info._ec2['region'],
|
connect_args = {
|
||||||
aws_access_key_id=info.credentials['access-key'],
|
'aws_access_key_id': info.credentials['access-key'],
|
||||||
aws_secret_access_key=info.credentials['secret-key'])
|
'aws_secret_access_key': info.credentials['secret-key']
|
||||||
|
}
|
||||||
|
|
||||||
|
if 'security-token' in info.credentials:
|
||||||
|
connect_args['security_token'] = info.credentials['security-token']
|
||||||
|
|
||||||
|
info._ec2['connection'] = connect_to_region(info._ec2['region'], **connect_args)
|
||||||
|
|
Loading…
Add table
Reference in a new issue