Harmonize static scope handling with upstream

change some code related to static credentials and system scope
back to how it is implemented in upstream.

Change-Id: Id466c9c1290782d3a3c8fa968f6dd5c17b1ed178
Related-Issue: PRODX-26229
diff --git a/tempest/lib/common/preprov_creds.py b/tempest/lib/common/preprov_creds.py
index 5b1d865..f7d5380 100644
--- a/tempest/lib/common/preprov_creds.py
+++ b/tempest/lib/common/preprov_creds.py
@@ -141,12 +141,12 @@
                 types = account.pop('types')
             if 'resources' in account:
                 resources = account.pop('resources')
-            if 'system' in account:
-                scope = 'system'
-            elif {'project_name', 'tenant_name'} & account.keys():
+            if 'project_name' in account:
                 scope = 'project'
             elif 'domain_name' in account:
                 scope = 'domain'
+            elif 'system' in account:
+                scope = 'system'
             temp_hash = md5(usedforsecurity=False)
             account_for_hash = dict((k, v) for (k, v) in account.items()
                                     if k in cls.HASH_CRED_FIELDS)
@@ -154,10 +154,9 @@
             temp_hash_key = temp_hash.hexdigest()
             hash_dict['creds'][temp_hash_key] = account
             for role in roles:
-                if scope == 'project':
-                    hash_dict = cls._append_role(role, temp_hash_key,
-                                                 hash_dict)
-                else:
+                hash_dict = cls._append_role(role, temp_hash_key,
+                                             hash_dict)
+                if scope:
                     hash_dict = cls._append_scoped_role(
                         scope, role, temp_hash_key, hash_dict)
             # If types are set for the account append the matching role