Merge "Fix "software --os-region-name SystemController show" returning 404"

This commit is contained in:
Zuul 2024-09-16 16:00:22 +00:00 committed by Gerrit Code Review
commit 93f38e5f62
2 changed files with 6 additions and 1 deletions

View File

@ -5,6 +5,7 @@
#
from oslo_utils import importutils
from urllib.parse import urljoin
from software_client import exc
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:
api_version_str = 'v' + api_version
if api_version_str not in endpoint.split('/'):
endpoint = endpoint + '/' + api_version_str
endpoint = urljoin(endpoint, api_version_str)
if session:
# this will be a LegacyJsonAdapter

View File

@ -122,6 +122,10 @@ def _display_info(text):
'''display the basic info json object '''
try:
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:
print(f"Invalid response format: {text}")
return