!101 [sync] PR-100: [bug fix]update the exception catching type of the function

From: @openeuler-sync-bot 
Reviewed-by: @Lostwayzxc 
Signed-off-by: @Lostwayzxc
This commit is contained in:
openeuler-ci-bot 2024-03-04 02:21:34 +00:00 committed by Gitee
commit b6ad69fadf
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 38 additions and 1 deletions

View File

@ -0,0 +1,33 @@
From 90076e3a777576a482f37db6f67331ffcd2783fb Mon Sep 17 00:00:00 2001
From: rabbitali <wenxin32@foxmail.com>
Date: Wed, 27 Dec 2023 10:35:35 +0800
Subject: [PATCH] update the exception catching type of the function
---
zeus/vulnerability_manage/view.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/zeus/vulnerability_manage/view.py b/zeus/vulnerability_manage/view.py
index 37ab633..0a3537a 100644
--- a/zeus/vulnerability_manage/view.py
+++ b/zeus/vulnerability_manage/view.py
@@ -19,6 +19,7 @@ from flask import Response, request
import sqlalchemy
import gevent
+from vulcanus.exceptions import DatabaseConnectionFailed
from vulcanus.log.log import LOGGER
from vulcanus.restful.resp import state
from vulcanus.restful.response import BaseResponse
@@ -70,7 +71,7 @@ def query_host_basic_info(host_list: list, username: str) -> Tuple[str, Dict]:
try:
with HostProxy() as proxy:
status_code, host_infos = proxy.get_host_info({"host_list": host_list, "username": username})
- except sqlalchemy.exc.SQLAlchemyError:
+ except DatabaseConnectionFailed:
LOGGER.error("Connect to database error")
return state.DATABASE_CONNECT_ERROR, dict()
--
2.33.0

View File

@ -1,6 +1,6 @@
Name: aops-zeus Name: aops-zeus
Version: v1.4.0 Version: v1.4.0
Release: 5 Release: 6
Summary: A host and user manager service which is the foundation of aops. Summary: A host and user manager service which is the foundation of aops.
License: MulanPSL2 License: MulanPSL2
URL: https://gitee.com/openeuler/%{name} URL: https://gitee.com/openeuler/%{name}
@ -14,6 +14,7 @@ Patch0006: 0006-update-verification-method-for-adding-host.patch
Patch0007: 0007-update-verification-method-for-host-ip-field.patch Patch0007: 0007-update-verification-method-for-host-ip-field.patch
Patch0008: 0008-check-host-status-when-query-host-detail.patch Patch0008: 0008-check-host-status-when-query-host-detail.patch
Patch0009: 0009-fix-error-log-when-query-host-status.patch Patch0009: 0009-fix-error-log-when-query-host-status.patch
Patch0010: 0010-update-the-exception-catching-type-of-the-function.patch
BuildRequires: python3-setuptools BuildRequires: python3-setuptools
@ -54,6 +55,9 @@ cp -r database %{buildroot}/opt/aops/
%changelog %changelog
* Wed Dec 27 2023 wenxin<wenxin32@foxmail.com> - v1.4.0-6
- update the exception catching type of the function
* Sun Dec 24 2023 luxuexian<luxuexian@huawei.com> - v1.4.0-5 * Sun Dec 24 2023 luxuexian<luxuexian@huawei.com> - v1.4.0-5
- fix error log when query host status - fix error log when query host status