diff options
author | ahothan <ahothan@cisco.com> | 2019-08-11 10:41:21 -0700 |
---|---|---|
committer | ahothan <ahothan@cisco.com> | 2019-08-11 10:47:04 -0700 |
commit | b56d9c7da8316f2371fb7d82f918cde7e96930dd (patch) | |
tree | 538a343b75d322dd0329a25a31ce4ef2b60501fe | |
parent | 09363d4f844128999780f6e287fc57662ca3b42a (diff) |
NFVBENCH-147 Incorrect URL used for admin check in credentials3.5.1
Change-Id: I7ac59c3dc5832509653bb1d42c26d3f55dcf1c4e
Signed-off-by: ahothan <ahothan@cisco.com>
-rw-r--r-- | nfvbench/credentials.py | 19 |
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) |