summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--nfvbench/credentials.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/nfvbench/credentials.py b/nfvbench/credentials.py
index 3a18981..9956c6f 100644
--- a/nfvbench/credentials.py
+++ b/nfvbench/credentials.py
@@ -167,13 +167,20 @@ class Credentials(object):
self.rc_password = ""
# check if user has admin role in OpenStack project
+ filter = {'service_type': 'identity',
+ 'interface': 'public',
+ 'region_name': self.rc_region_name}
try:
- # vX/users URL returns exception (HTTP 403) if user is not admin.
+ # /users URL returns exception (HTTP 403) if user is not admin.
+ # try first without the version in case session already has it in
# Return HTTP 200 if user is admin
- self.get_session().get('/v' + str(self.rc_identity_api_version) + '/users',
- endpoint_filter={'service_type': 'identity',
- 'interface': 'public',
- 'region_name': self.rc_region_name})
+ self.get_session().get('/users', endpoint_filter=filter)
self.is_admin = True
except Exception as e:
- LOG.warning("User is not admin, no permission to list user roles. Exception: %s", e)
+ try:
+ # vX/users URL returns exception (HTTP 403) if user is not admin.
+ self.get_session().get('/v' + str(self.rc_identity_api_version) + '/users',
+ endpoint_filter=filter)
+ self.is_admin = True
+ except Exception as e:
+ LOG.warning("User is not admin, no permission to list user roles. Exception: %s", e)