diff options
author | Matthew Treinish <mtreinish@kortar.org> | 2015-04-13 20:30:06 -0400 |
---|---|---|
committer | Matthew Treinish <mtreinish@kortar.org> | 2015-04-20 17:29:13 -0400 |
commit | fd683e81cc776d295548f03a2603aa5fc39758d6 (patch) | |
tree | 3e1f71e08ac1b0f3df7ddbc804f99a5e4a433201 | |
parent | f83f35c9e25e2bdbe9cee06972bde1a6aedc6dc7 (diff) | |
download | tempest-fd683e81cc776d295548f03a2603aa5fc39758d6.tar.gz |
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
-rw-r--r-- | tempest/common/accounts.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tempest/common/accounts.py b/tempest/common/accounts.py index acf6d4fa9..93c8bcf79 100644 --- a/tempest/common/accounts.py +++ b/tempest/common/accounts.py @@ -180,12 +180,20 @@ class Accounts(cred_provider.CredentialProvider): 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 @@ class Accounts(cred_provider.CredentialProvider): 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'): |