Fix "software --os-region-name SystemController show" returning 404
An extra "/" was appended to the SystemController usm internal endpoint which resulted in an incorrect request URL. Test plan: PASS: Successfully run "software --os-region-name SystemController show" PASS: Successfully run "software --os-region-name RegionOne show" PASS: Successfully run "software show" PASS: Successfully run "software --os-region-name SystemController is-deployed" PASS: Successfully run "software is-deployed" PASS: Successfully run "software --os-region-name SystemController delete" PASS: Successfully run "software delete" Closes-Bug: 2080067 Change-Id: I4df3b17ab6ebff83a7b8849af3692752ff104dad Signed-off-by: lzhu1 <li.zhu@windriver.com>
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
from oslo_utils import importutils
|
from oslo_utils import importutils
|
||||||
|
from urllib.parse import urljoin
|
||||||
|
|
||||||
from software_client import exc
|
from software_client import exc
|
||||||
from software_client.constants import LOCAL_ROOT
|
from software_client.constants import LOCAL_ROOT
|
||||||
@@ -131,7 +132,7 @@ def get_client(api_version, auth_mode, session=None, service_type=SERVICE_TYPE,
|
|||||||
if endpoint:
|
if endpoint:
|
||||||
api_version_str = 'v' + api_version
|
api_version_str = 'v' + api_version
|
||||||
if api_version_str not in endpoint.split('/'):
|
if api_version_str not in endpoint.split('/'):
|
||||||
endpoint = endpoint + '/' + api_version_str
|
endpoint = urljoin(endpoint, api_version_str)
|
||||||
|
|
||||||
if session:
|
if session:
|
||||||
# this will be a LegacyJsonAdapter
|
# this will be a LegacyJsonAdapter
|
||||||
|
@@ -122,6 +122,10 @@ def _display_info(text):
|
|||||||
'''display the basic info json object '''
|
'''display the basic info json object '''
|
||||||
try:
|
try:
|
||||||
data = json.loads(text)
|
data = json.loads(text)
|
||||||
|
if "error_message" in data:
|
||||||
|
data = json.loads(data["error_message"])
|
||||||
|
if "faultstring" in data:
|
||||||
|
data = json.loads(data["faultstring"])
|
||||||
except Exception:
|
except Exception:
|
||||||
print(f"Invalid response format: {text}")
|
print(f"Invalid response format: {text}")
|
||||||
return
|
return
|
||||||
|
Reference in New Issue
Block a user