From b56d9c7da8316f2371fb7d82f918cde7e96930dd Mon Sep 17 00:00:00 2001 From: ahothan Date: Sun, 11 Aug 2019 10:41:21 -0700 Subject: NFVBENCH-147 Incorrect URL used for admin check in credentials Change-Id: I7ac59c3dc5832509653bb1d42c26d3f55dcf1c4e Signed-off-by: ahothan --- nfvbench/credentials.py | 19 +++++++++++++------ 1 file 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) -- cgit 1.2.3-korg