Handle cgts-client calls for non-admin users
Handle http client exceptions for non-admin users. This is because some alarms/events metadata are not available for them. For example if the call fails the user will see the a value like: "host=controller-1.port=enp0s8" instead of: "host=controller-1.port=0cbb441a-874d-418e-bd57-7aa1b8ab0044" Before this if an error in translation happened, the user experienced an alert badge saying "Unable to retrieve Events", then the user seen an empty table. Story: 2009077 Task: 43093 Signed-off-by: Pablo Bovina <pablo.bovina@windriver.com> Change-Id: I68eeb103a6fe97beb1fb7969a1cd9503210cdcb0
This commit is contained in:
parent
83f5caa9b7
commit
51ba594bf8
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 2018 Wind River Systems, Inc.
|
# Copyright (c) 2018-2021 Wind River Systems, Inc.
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
#
|
#
|
||||||
@ -10,6 +10,7 @@ import contextlib
|
|||||||
import traceback
|
import traceback
|
||||||
import pecan
|
import pecan
|
||||||
import wsme
|
import wsme
|
||||||
|
from cgtsclient import exc
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
from oslo_utils import uuidutils
|
from oslo_utils import uuidutils
|
||||||
@ -112,6 +113,10 @@ def replace_name_with_uuid(instance_id):
|
|||||||
except exceptions.ServerNotFound:
|
except exceptions.ServerNotFound:
|
||||||
LOG.error("Can't find the port for name %s", value)
|
LOG.error("Can't find the port for name %s", value)
|
||||||
pass
|
pass
|
||||||
|
except exc.HTTPException as http_exc:
|
||||||
|
msg = "Http request failed with code {}"
|
||||||
|
LOG.error(msg.format(http_exc.code))
|
||||||
|
pass
|
||||||
|
|
||||||
if port:
|
if port:
|
||||||
new_id = key + KEY_VALUE_SEP + port.uuid
|
new_id = key + KEY_VALUE_SEP + port.uuid
|
||||||
|
Loading…
x
Reference in New Issue
Block a user