Move default creds to cred_provider
Credential types available in configuration, and how to parse
them and validate them is currently embedded in the Credentials
class hierarchy.
Move the entire logic to cred_provider, in preparation for the
migration of the auth module to tempest-lib.
The pre-provisioned account credential provider relied on
the list of configured field to find the hash for a set of
credentials. Changed that to use the list of attributes with
which the credentials were initially setup.
Change-Id: Ic3ff15799f016277e6eb59c53cf8f24f6a7be9c9
diff --git a/tempest/common/accounts.py b/tempest/common/accounts.py
index 66285e4..35a1f86 100644
--- a/tempest/common/accounts.py
+++ b/tempest/common/accounts.py
@@ -109,9 +109,9 @@
def get_hash(self, creds):
for _hash in self.hash_dict:
- # Comparing on the attributes that are expected in the YAML
+ # Comparing on the attributes that were read from the YAML
if all([getattr(creds, k) == self.hash_dict[_hash][k] for k in
- creds.CONF_ATTRIBUTES]):
+ creds.get_init_attributes()]):
return _hash
raise AttributeError('Invalid credentials %s' % creds)
@@ -191,7 +191,8 @@
creds = self.get_creds(0)
primary_credential = auth.get_credentials(**creds)
else:
- primary_credential = auth.get_default_credentials('user')
+ primary_credential = cred_provider.get_configured_credentials(
+ 'user')
self.isolated_creds['primary'] = primary_credential
return primary_credential
@@ -202,7 +203,8 @@
creds = self.get_creds(1)
alt_credential = auth.get_credentials(**creds)
else:
- alt_credential = auth.get_default_credentials('alt_user')
+ alt_credential = cred_provider.get_configured_credentials(
+ 'alt_user')
self.isolated_creds['alt'] = alt_credential
return alt_credential
@@ -210,4 +212,5 @@
self.isolated_creds = {}
def get_admin_creds(self):
- return auth.get_default_credentials("identity_admin", fill_in=False)
+ return cred_provider.get_configured_credentials(
+ "identity_admin", fill_in=False)