summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYichen Wang <yicwang@cisco.com>2019-04-11 14:33:44 -0700
committerYichen Wang <yicwang@cisco.com>2019-04-11 14:38:30 -0700
commit8ae0abbe6ecc32af01d755a3f3eab38bfa631b6b (patch)
treeba53d26252e7129c058d38184c8ab9295daeda2c
parentae470028c29a56ea954afb14f7e2de62441686ed (diff)
[NFVBENCH-129] Fix regression to work on Keystone v2
Change-Id: I86196db2245db6272a8c21d25d395dad343d3f90 Signed-off-by: Yichen Wang <yicwang@cisco.com>
-rw-r--r--nfvbench/credentials.py8
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