diff options
-rw-r--r-- | nfvbench/credentials.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/nfvbench/credentials.py b/nfvbench/credentials.py index b3e4a04..17811f9 100644 --- a/nfvbench/credentials.py +++ b/nfvbench/credentials.py @@ -172,8 +172,12 @@ class Credentials(object): try: keystone = client.Client(session=self.get_session()) user = utils.find_resource(keystone.users, self.rc_username) - project = utils.find_resource(keystone.projects, self.rc_project_name) - roles = keystone.roles.list(user=user.id, project=project.id) + if self.rc_identity_api_version == 2: + tenant = utils.find_resource(keystone.tenants, self.rc_tenant_name) + roles = keystone.roles.roles_for_user(user, tenant=tenant.id) + elif self.rc_identity_api_version == 3: + project = utils.find_resource(keystone.projects, self.rc_project_name) + roles = keystone.roles.list(user=user.id, project=project.id) for role in roles: if role.name == 'admin': self.is_admin = True |