summaryrefslogtreecommitdiff
path: root/tempest/common/credentials_factory.py
diff options
context:
space:
mode:
authorAndrea Frittoli <andrea.frittoli@gmail.com>2017-07-18 11:34:13 +0100
committerAndrea Frittoli <andrea.frittoli@gmail.com>2017-07-20 20:42:36 +0000
commitdcd9100d03ddadf931cf18e8701911440a40cf21 (patch)
tree4d3e92cd4152eabb78cc060e31ce6b6ebd9c71f1 /tempest/common/credentials_factory.py
parent12972ae5803c68b3c5a0958ede0abd0251e37f40 (diff)
downloadtempest-dcd9100d03ddadf931cf18e8701911440a40cf21.tar.gz
Remove creds providers dependency from clients
We want to make cred providers a stable interface and move it to lib but to do so it must not depend on modules outside of lib or not generally stable otherwise. The last dependency left is tempest.clients, which can be replaced by its tempest.lib counterpart, tempest.lib.services.clients. While clients does not depend on configuration directly, it uses the client registry singleton. When this class is used as part of tempest, it's populated with configuration values the first time the CONF object is instantiated, so that Tempest configuration values are still honoured. When DynamicCredentialProvider is used by a consumer that does not have a Tempest config file, all the settings defined in __init__ will be honoured. To control more settings, the client registry must be populated before the Credentials Provider is used with the appropriate settings. Change-Id: I7b262607a1fa9f67e6b1d3ec2c4cf1ccffb952a6
Diffstat (limited to 'tempest/common/credentials_factory.py')
-rw-r--r--tempest/common/credentials_factory.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/tempest/common/credentials_factory.py b/tempest/common/credentials_factory.py
index bf7ec9949..449c34389 100644
--- a/tempest/common/credentials_factory.py
+++ b/tempest/common/credentials_factory.py
@@ -40,8 +40,13 @@ to avoid circular dependencies."""
# Subset of the parameters of credential providers that depend on configuration
def _get_common_provider_params(identity_version):
+ if identity_version == 'v3':
+ identity_uri = CONF.identity.uri_v3
+ elif identity_version == 'v2':
+ identity_uri = CONF.identity.uri
return {
'identity_version': identity_version,
+ 'identity_uri': identity_uri,
'credentials_domain': CONF.auth.default_credentials_domain_name,
'admin_role': CONF.identity.admin_role
}
@@ -63,6 +68,10 @@ def get_dynamic_provider_params(identity_version, admin_creds=None):
_common_params = _get_common_provider_params(identity_version)
admin_creds = admin_creds or get_configured_admin_credentials(
fill_in=True, identity_version=identity_version)
+ if identity_version == 'v3':
+ endpoint_type = CONF.identity.v3_endpoint_type
+ elif identity_version == 'v2':
+ endpoint_type = CONF.identity.v2_admin_endpoint_type
return dict(_common_params, **dict([
('admin_creds', admin_creds),
('identity_admin_domain_scope', CONF.identity.admin_domain_scope),
@@ -74,7 +83,8 @@ def get_dynamic_provider_params(identity_version, admin_creds=None):
('public_network_id', CONF.network.public_network_id),
('create_networks', (CONF.auth.create_isolated_networks and not
CONF.network.shared_physical_network)),
- ('resource_prefix', CONF.resources_prefix)
+ ('resource_prefix', CONF.resources_prefix),
+ ('identity_admin_endpoint_type', endpoint_type)
]))