Merge "Remove dependency from credentials domain CONF"
diff --git a/tempest/common/cred_provider.py b/tempest/common/cred_provider.py
index eb4c4a8..089f3af 100644
--- a/tempest/common/cred_provider.py
+++ b/tempest/common/cred_provider.py
@@ -98,17 +98,20 @@
@six.add_metaclass(abc.ABCMeta)
class CredentialProvider(object):
- def __init__(self, identity_version, name=None,
- network_resources=None):
+ def __init__(self, identity_version, name=None, network_resources=None,
+ credentials_domain=None):
"""A CredentialProvider supplies credentials to test classes.
:param identity_version: Identity version of the credentials provided
:param name: Name of the calling test. Included in provisioned
credentials when credentials are provisioned on the fly
:param network_resources: Network resources required for the
credentials
+ :param credentials_domain: Domain credentials belong to
"""
- self.name = name or "test_creds"
self.identity_version = identity_version
+ self.name = name or "test_creds"
+ self.network_resources = network_resources
+ self.credentials_domain = credentials_domain or 'Default'
if not auth.is_identity_version_supported(self.identity_version):
raise exceptions.InvalidIdentityVersion(
identity_version=self.identity_version)
diff --git a/tempest/common/credentials.py b/tempest/common/credentials.py
index 1b2eca7..88ae9ce 100644
--- a/tempest/common/credentials.py
+++ b/tempest/common/credentials.py
@@ -37,13 +37,15 @@
return dynamic_creds.DynamicCredentialProvider(
name=name,
network_resources=network_resources,
- identity_version=identity_version)
+ identity_version=identity_version,
+ credentials_domain=CONF.auth.default_credentials_domain_name)
else:
if (CONF.auth.test_accounts_file and
os.path.isfile(CONF.auth.test_accounts_file)):
# Most params are not relevant for pre-created accounts
return preprov_creds.PreProvisionedCredentialProvider(
- name=name, identity_version=identity_version)
+ name=name, identity_version=identity_version,
+ credentials_domain=CONF.auth.default_credentials_domain_name)
else:
return preprov_creds.NonLockingCredentialProvider(
name=name, identity_version=identity_version)
diff --git a/tempest/common/dynamic_creds.py b/tempest/common/dynamic_creds.py
index d9cfac8..7413c8c 100644
--- a/tempest/common/dynamic_creds.py
+++ b/tempest/common/dynamic_creds.py
@@ -30,11 +30,12 @@
class DynamicCredentialProvider(cred_provider.CredentialProvider):
- def __init__(self, identity_version, name=None,
- network_resources=None):
+ def __init__(self, identity_version, name=None, network_resources=None,
+ credentials_domain=None):
super(DynamicCredentialProvider, self).__init__(
- identity_version, name, network_resources)
- self.network_resources = network_resources
+ identity_version=identity_version, name=name,
+ network_resources=network_resources,
+ credentials_domain=credentials_domain)
self._creds = {}
self.ports = []
self.default_admin_creds = cred_provider.get_configured_credentials(
@@ -49,7 +50,7 @@
if self.identity_version == 'v3':
self.creds_domain_name = (
self.default_admin_creds.project_domain_name or
- CONF.auth.default_credentials_domain_name)
+ self.credentials_domain)
self.creds_client = cred_client.get_creds_client(
self.identity_admin_client, self.creds_domain_name)
diff --git a/tempest/common/preprov_creds.py b/tempest/common/preprov_creds.py
index 48eae25..c951972 100644
--- a/tempest/common/preprov_creds.py
+++ b/tempest/common/preprov_creds.py
@@ -39,9 +39,10 @@
class PreProvisionedCredentialProvider(cred_provider.CredentialProvider):
- def __init__(self, identity_version, name=None):
+ def __init__(self, identity_version, name=None, credentials_domain=None):
super(PreProvisionedCredentialProvider, self).__init__(
- identity_version=identity_version, name=name)
+ identity_version=identity_version, name=name,
+ credentials_domain=credentials_domain)
if (CONF.auth.test_accounts_file and
os.path.isfile(CONF.auth.test_accounts_file)):
accounts = read_accounts_yaml(CONF.auth.test_accounts_file)
@@ -217,7 +218,7 @@
if ('user_domain_name' in init_attributes and 'user_domain_name'
not in hash_attributes):
# Allow for the case of domain_name populated from config
- domain_name = CONF.auth.default_credentials_domain_name
+ domain_name = self.credentials_domain
hash_attributes['user_domain_name'] = domain_name
if all([getattr(creds, k) == hash_attributes[k] for
k in init_attributes]):
@@ -306,8 +307,7 @@
if self.identity_version == 'v3':
user_domain_fields = set(['user_domain_name', 'user_domain_id'])
if not user_domain_fields.intersection(set(creds_dict.keys())):
- _domain = CONF.auth.default_credentials_domain_name
- creds_dict['user_domain_name'] = _domain
+ creds_dict['user_domain_name'] = self.credentials_domain
return creds_dict