Add EC2-API support
Change-Id: I92a0fca191fbf59fa4409cc238e0a42c495daf4d
This commit is contained in:
parent
96a257e6c7
commit
03aff13d9d
|
@ -205,6 +205,8 @@ def main():
|
|||
configure_boto(conf, services)
|
||||
configure_keystone_feature_flags(conf, services)
|
||||
configure_horizon(conf)
|
||||
if "ec2" in services:
|
||||
configure_ec2api(conf, clients.users)
|
||||
|
||||
# remove all unwanted values if were specified
|
||||
if args.remove != {}:
|
||||
|
@ -1002,6 +1004,26 @@ def configure_horizon(conf):
|
|||
conf.set('dashboard', 'login_url', base + '/auth/login/')
|
||||
|
||||
|
||||
def configure_ec2api(conf, clients):
|
||||
"""Create ec2 credentials and set configs."""
|
||||
username = conf.get('identity', 'username')
|
||||
tenant_name = conf.get('identity', 'tenant_name')
|
||||
users = clients.users.list_users()
|
||||
user_ids = [u['id'] for u in users['users'] if u['name'] == username]
|
||||
user_id = user_ids[0]
|
||||
tenant_id = clients.tenants.get_project_by_name(tenant_name)['id']
|
||||
resp = users_client.create_user_ec2_credential(
|
||||
user_id, tenant_id=tenant_id)['credential']
|
||||
access = resp['access']
|
||||
secret = resp['secret']
|
||||
conf.set('aws', 'aws_access', access)
|
||||
conf.set('aws', 'aws_secret', secret)
|
||||
flavor_ref = conf.get('compute', 'flavor_ref')
|
||||
flavor_ref_alt = conf.get('compute', 'flavor_ref_alt')
|
||||
conf.set('aws', 'instance_type', flavor_ref)
|
||||
conf.set('aws', 'instance_type_alt', flavor_ref_alt)
|
||||
|
||||
|
||||
def configure_discovered_services(conf, services):
|
||||
"""Set service availability and supported extensions and versions.
|
||||
|
||||
|
|
Loading…
Reference in New Issue