diff options
Diffstat (limited to 'tempest/common/accounts.py')
-rw-r--r-- | tempest/common/accounts.py | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/tempest/common/accounts.py b/tempest/common/accounts.py index 7423c17e7..88e8ced08 100644 --- a/tempest/common/accounts.py +++ b/tempest/common/accounts.py @@ -58,7 +58,12 @@ class Accounts(cred_provider.CredentialProvider): return hash_dict def is_multi_user(self): - return len(self.hash_dict) > 1 + # Default credentials is not a valid option with locking Account + if self.use_default_creds: + raise exceptions.InvalidConfiguration( + "Account file %s doesn't exist" % CONF.auth.test_accounts_file) + else: + return len(self.hash_dict) > 1 def _create_hash_file(self, hash_string): path = os.path.join(os.path.join(self.accounts_dir, hash_string)) @@ -144,6 +149,21 @@ class NotLockingAccounts(Accounts): to preserve the current behaviour of the serial tempest run. """ + def is_multi_user(self): + if self.use_default_creds: + # Verify that the configured users are valid and distinct + try: + user = self.get_primary_creds() + alt_user = self.get_alt_creds() + return user.username != alt_user.username + except exceptions.InvalidCredentials as ic: + msg = "At least one of the configured credentials is " \ + "not valid: %s" % ic.message + raise exceptions.InvalidConfiguration(msg) + else: + # TODO(andreaf) Add a uniqueness check here + return len(self.hash_dict) > 1 + def get_creds(self, id): try: # No need to sort the dict as within the same python process |