Add EC2-API support
Change-Id: I92a0fca191fbf59fa4409cc238e0a42c495daf4d
This commit is contained in:
parent
5fa5f9c51d
commit
5bc1d6888a
|
@ -269,4 +269,5 @@ def discover(auth_provider, region, object_store_discovery=True,
|
|||
elif 'v3' not in ep[public_url]: # is not v3 url
|
||||
services[name]['extensions'] = service.get_extensions()
|
||||
services[name]['versions'] = service.get_versions()
|
||||
LOG.debug("Discovered services: %s", services)
|
||||
return services
|
||||
|
|
|
@ -95,6 +95,7 @@ SERVICE_NAMES = {
|
|||
'messaging': 'zaqar',
|
||||
'metric': 'gnocchi',
|
||||
'event': 'panko',
|
||||
'ec2': 'ec2',
|
||||
}
|
||||
|
||||
# what API versions could the service have and should be enabled/disabled
|
||||
|
@ -205,6 +206,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 +1005,28 @@ def configure_horizon(conf):
|
|||
conf.set('dashboard', 'login_url', base + '/auth/login/')
|
||||
|
||||
|
||||
def configure_ec2api(conf, clients):
|
||||
"""Create ec2 credentials and set configs."""
|
||||
LOG.debug("Configuring EC2-API")
|
||||
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']
|
||||
LOG.debug("Created EC2 credentials: %s", resp)
|
||||
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.
|
||||
|
||||
|
|
|
@ -430,7 +430,7 @@ class TestConfigTempest(BaseConfigTempestTest):
|
|||
self._mock_get_identity_v3_extensions()
|
||||
tool.configure_discovered_services(self.conf, self.FAKE_SERVICES)
|
||||
# check enabled services
|
||||
enabled_services = ["image", "volume", "compute", "network"]
|
||||
enabled_services = ["image", "volume", "compute", "network", "ec2"]
|
||||
# iterating through tuples = (service_name, codename)
|
||||
for service in tool.SERVICE_NAMES.iteritems():
|
||||
if service[0] in enabled_services:
|
||||
|
|
Loading…
Reference in New Issue