update the exception catching type of the function
(cherry picked from commit cf250c319697c1aee0a40f9d1360d945ee0b87ce)
This commit is contained in:
parent
1b686d7075
commit
c9b241fa11
@ -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
|
||||||
|
|
||||||
@ -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
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user