From c9b241fa1157c995f9ecb6b7eafd7c9334fc4896 Mon Sep 17 00:00:00 2001 From: rabbitali Date: Wed, 27 Dec 2023 15:15:46 +0800 Subject: [PATCH] update the exception catching type of the function (cherry picked from commit cf250c319697c1aee0a40f9d1360d945ee0b87ce) --- ...eption-catching-type-of-the-function.patch | 33 +++++++++++++++++++ aops-zeus.spec | 6 +++- 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 0010-update-the-exception-catching-type-of-the-function.patch diff --git a/0010-update-the-exception-catching-type-of-the-function.patch b/0010-update-the-exception-catching-type-of-the-function.patch new file mode 100644 index 0000000..f78ed7c --- /dev/null +++ b/0010-update-the-exception-catching-type-of-the-function.patch @@ -0,0 +1,33 @@ +From 90076e3a777576a482f37db6f67331ffcd2783fb Mon Sep 17 00:00:00 2001 +From: rabbitali +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 + diff --git a/aops-zeus.spec b/aops-zeus.spec index 5347e4b..404acbc 100644 --- a/aops-zeus.spec +++ b/aops-zeus.spec @@ -1,6 +1,6 @@ Name: aops-zeus Version: v1.4.0 -Release: 5 +Release: 6 Summary: A host and user manager service which is the foundation of aops. License: MulanPSL2 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 Patch0008: 0008-check-host-status-when-query-host-detail.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 @@ -54,6 +55,9 @@ cp -r database %{buildroot}/opt/aops/ %changelog +* Wed Dec 27 2023 wenxin - v1.4.0-6 +- update the exception catching type of the function + * Sun Dec 24 2023 luxuexian - v1.4.0-5 - fix error log when query host status -- Gitee