From dcd9100d03ddadf931cf18e8701911440a40cf21 Mon Sep 17 00:00:00 2001 From: Andrea Frittoli Date: Tue, 18 Jul 2017 11:34:13 +0100 Subject: 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 --- tempest/common/credentials_factory.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'tempest/common/credentials_factory.py') 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) ])) -- cgit v1.2.1