From f39f9f31f2b04d3cec2d3df9242134bc645e5e53 Mon Sep 17 00:00:00 2001 From: "Andrea Frittoli (andreaf)" Date: Mon, 13 Apr 2015 20:55:31 +0100 Subject: FIx Accounts with identity v3 and v2 data in yaml When tempest uses identity v3 - either because it's forced by a test, or because it's configured as default, accounts can still work with v2 accounts configured in accounts.yaml, under the assumption that those accounts belong to CONF.identity.admin_domain_name. The domain name is added on the fly to newly created credentials by cred_provider, however this is not accounted for in the get_hash function - fixing that. Change-Id: Id0e72b9a8b85fdc682b9e14c39ecc1d8495ef35c --- tempest/common/accounts.py | 11 +++++++++-- tempest/common/cred_provider.py | 2 ++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/tempest/common/accounts.py b/tempest/common/accounts.py index 6d376d628..1d5516f27 100644 --- a/tempest/common/accounts.py +++ b/tempest/common/accounts.py @@ -190,8 +190,15 @@ class Accounts(cred_provider.CredentialProvider): def get_hash(self, creds): for _hash in self.hash_dict['creds']: # Comparing on the attributes that are expected in the YAML - if all([getattr(creds, k) == self.hash_dict['creds'][_hash][k] for - k in creds.get_init_attributes()]): + init_attributes = creds.get_init_attributes() + hash_attributes = self.hash_dict['creds'][_hash].copy() + if ('user_domain_name' in init_attributes and 'user_domain_name' + not in hash_attributes): + # Allow for the case of domain_name populated from config + domain_name = CONF.identity.admin_domain_name + hash_attributes['user_domain_name'] = domain_name + if all([getattr(creds, k) == hash_attributes[k] for + k in init_attributes]): return _hash raise AttributeError('Invalid credentials %s' % creds) diff --git a/tempest/common/cred_provider.py b/tempest/common/cred_provider.py index 2c6763df2..32230276e 100644 --- a/tempest/common/cred_provider.py +++ b/tempest/common/cred_provider.py @@ -84,6 +84,8 @@ def get_credentials(fill_in=True, identity_version=None, **kwargs): domain_fields = set(x for x in auth.KeystoneV3Credentials.ATTRIBUTES if 'domain' in x) if not domain_fields.intersection(kwargs.keys()): + # TODO(andreaf) It might be better here to use a dedicated config + # option such as CONF.auth.tenant_isolation_domain_name params['user_domain_name'] = CONF.identity.admin_domain_name auth_url = CONF.identity.uri_v3 else: -- cgit v1.2.1