Unable to resolve v3 url when sw-manager is invoked
When the OpenStack RC file is exported from Horizon the url in the OS_AUTH_URL variable does not include the /v3 API version. This causes that when the sw-manager command is invoked and trying to get the token, it returns error 300. This fix is to catch the error and get the URL of the location which points to the /v3 API version. Closes-Bug: 1998949 Test Plan: - Download OpenStack RC file from horizon then source it in remote machine. - Use remote-cli to execute sw-manager patch-strategy show Signed-off-by: Cristian Mondo <cristian.mondo@windriver.com> Change-Id: Ib5112bed26c2b773a460377af8be0c7ec12c80ae
This commit is contained in:
parent
53426842b0
commit
d76a07f78a
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2016 Wind River Systems, Inc.
|
||||
# Copyright (c) 2016-2022 Wind River Systems, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
@ -32,6 +32,14 @@ def get_token(auth_uri, project_name, project_domain_name, username, password,
|
||||
"""
|
||||
Ask OpenStack for a token
|
||||
"""
|
||||
try:
|
||||
request_url = urllib.request.urlopen(auth_uri)
|
||||
except urllib.error.HTTPError as e:
|
||||
if e.code == 300:
|
||||
auth_uri = e.headers['location']
|
||||
if auth_uri.endswith('/'):
|
||||
auth_uri = auth_uri[:-1]
|
||||
|
||||
try:
|
||||
url = auth_uri + "/auth/tokens"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user