Add logging of account allocation to accounts provider
This commit adds a log message to the locking accounts cred provider
to indicate when it has allocated a set of credentials successfully
from the accounts file. Right now when reading the tempest log file
during a run when using an accounts file there is no way to tell which
accounts where returned by the cred provider. This adds a info log msg
similar to what we log in isolated creds when it creates a new set of
creds. This should make it easier to trace through when credentials are
being allocated from the accounts file.
Change-Id: I82af7a3cba1e62cada94a9f4220666f1733e0575
diff --git a/tempest/common/accounts.py b/tempest/common/accounts.py
index acf6d4f..93c8bcf 100644
--- a/tempest/common/accounts.py
+++ b/tempest/common/accounts.py
@@ -180,12 +180,20 @@
useable_hashes = hashes
return useable_hashes
+ def _sanitize_creds(self, creds):
+ temp_creds = creds.copy()
+ temp_creds.pop('password')
+ return temp_creds
+
def _get_creds(self, roles=None):
if self.use_default_creds:
raise exceptions.InvalidConfiguration(
"Account file %s doesn't exist" % CONF.auth.test_accounts_file)
useable_hashes = self._get_match_hash_list(roles)
free_hash = self._get_free_hash(useable_hashes)
+ clean_creds = self._sanitize_creds(
+ self.hash_dict['creds'][free_hash])
+ LOG.info('%s allocated creds:\n%s' % (self.name, clean_creds))
return self._wrap_creds_with_network(free_hash)
@lockutils.synchronized('test_accounts_io', external=True)
@@ -216,7 +224,9 @@
def remove_credentials(self, creds):
_hash = self.get_hash(creds)
+ clean_creds = self._sanitize_creds(self.hash_dict['creds'][_hash])
self.remove_hash(_hash)
+ LOG.info("%s returned allocated creds:\n%s" % (self.name, clean_creds))
def get_primary_creds(self):
if self.isolated_creds.get('primary'):