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
diff --git a/tempest/common/accounts.py b/tempest/common/accounts.py
index 6d376d6..1d5516f 100644
--- a/tempest/common/accounts.py
+++ b/tempest/common/accounts.py
@@ -190,8 +190,15 @@
     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)