From 277a26d01dba32d307cd23eef3c4f97ab1024721 Mon Sep 17 00:00:00 2001 From: "Zhang Rong(Jon)" Date: Tue, 7 May 2024 11:25:29 +0800 Subject: [PATCH] Fix the fault client returns 500 instend of 404 The dependency on the FM module was changed, resulting in it returning HTTP code 500 instead of HTTP code 404 for not found errors. This commit is a workaround to track the 500 error and skip. When the FM module upgrade, need to be change back Test Plan: PASS - Started the watcher service and checked the logs on the O2 environment for alarms that do not exist on the O-Cloud. Issue-ID: INF-457 Change-Id: Ie2050bda5dd9fc724051de5e861a82fe9f495c44 Signed-off-by: Zhang Rong(Jon) --- o2ims/adapter/clients/fault_client.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/o2ims/adapter/clients/fault_client.py b/o2ims/adapter/clients/fault_client.py index c9e1e95..953beb9 100644 --- a/o2ims/adapter/clients/fault_client.py +++ b/o2ims/adapter/clients/fault_client.py @@ -21,7 +21,7 @@ from cgtsclient.client import get_client as get_stx_client from cgtsclient.exc import EndpointException from dcmanagerclient.api.client import client as get_dc_client from fmclient.client import get_client as get_fm_client -from fmclient.common.exceptions import HTTPNotFound +from fmclient.common.exceptions import HTTPNotFound, HttpServerError from o2app.adapter import unit_of_work from o2common.config import config @@ -85,6 +85,11 @@ class StxAlarmClient(BaseClient): logger.debug('alarm {} not in this resource pool {}' .format(alarm, self._pool_id)) continue + except HttpServerError: + # TODO(jon): This exception needs to be removed when the + # INF-457 related FM client upgrade and issue fix occur. + logger.debug('alarm {} query failed'.format(alarm)) + continue ret.append(event) return ret -- 2.16.6