Finish cleanup CONF from auth
KeystoneV3Credentials use configuration to pass add domain information if
missing. In preparation for migration to tempest-lib, remove that logic,
and move it to get_credentials in cred_provider.
Change-Id: I3adee2c047d63af55597e42c5a299dfa2c49001a
diff --git a/tempest/auth.py b/tempest/auth.py
index 7e1928f..ffeae02 100644
--- a/tempest/auth.py
+++ b/tempest/auth.py
@@ -22,13 +22,11 @@
import six
-from tempest import config
from tempest.openstack.common import log as logging
from tempest.services.identity.json import token_client as json_id
from tempest.services.identity.v3.json import token_client as json_v3id
-CONF = config.CONF
LOG = logging.getLogger(__name__)
@@ -564,16 +562,6 @@
'project_name', 'tenant_id', 'tenant_name', 'user_domain_id',
'user_domain_name', 'user_id']
- def __init__(self, **kwargs):
- """
- If domain is not specified, load the one configured for the
- identity manager.
- """
- domain_fields = set(x for x in self.ATTRIBUTES if 'domain' in x)
- if not domain_fields.intersection(kwargs.keys()):
- kwargs['user_domain_name'] = CONF.identity.admin_domain_name
- super(KeystoneV3Credentials, self).__init__(**kwargs)
-
def __setattr__(self, key, value):
parent = super(KeystoneV3Credentials, self)
# for tenant_* set both project and tenant
diff --git a/tempest/common/cred_provider.py b/tempest/common/cred_provider.py
index f40ed7a..d899303 100644
--- a/tempest/common/cred_provider.py
+++ b/tempest/common/cred_provider.py
@@ -70,6 +70,12 @@
# is none is specified
def get_credentials(fill_in=True, identity_version=None, **kwargs):
identity_version = identity_version or CONF.identity.auth_version
+ # In case of "v3" add the domain from config if not specified
+ if identity_version == 'v3':
+ domain_fields = set(x for x in auth.KeystoneV3Credentials.ATTRIBUTES
+ if 'domain' in x)
+ if not domain_fields.intersection(kwargs.keys()):
+ kwargs['user_domain_name'] = CONF.identity.admin_domain_name
return auth.get_credentials(fill_in=fill_in,
identity_version=identity_version,
**kwargs)