From 0d79813dfe66f42573daf4a8213884aa209e475a Mon Sep 17 00:00:00 2001 From: rearcher <123781007@qq.com> Date: Sun, 24 Dec 2023 21:14:24 +0800 Subject: [PATCH] fix error log when query host status --- ...fix-error-log-when-query-host-status.patch | 47 +++++++++++++++++++ aops-zeus.spec | 6 ++- 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 0009-fix-error-log-when-query-host-status.patch diff --git a/0009-fix-error-log-when-query-host-status.patch b/0009-fix-error-log-when-query-host-status.patch new file mode 100644 index 0000000..e212cda --- /dev/null +++ b/0009-fix-error-log-when-query-host-status.patch @@ -0,0 +1,47 @@ +From eaf05c0588e595d2f635c6bae867db5f15c3b034 Mon Sep 17 00:00:00 2001 +From: rearcher <123781007@qq.com> +Date: Sun, 24 Dec 2023 21:01:19 +0800 +Subject: [PATCH] fix log error + +--- + zeus/host_manager/view.py | 13 ++++++++++--- + 1 file changed, 10 insertions(+), 3 deletions(-) + +diff --git a/zeus/host_manager/view.py b/zeus/host_manager/view.py +index 30d05a3..d13868c 100644 +--- a/zeus/host_manager/view.py ++++ b/zeus/host_manager/view.py +@@ -139,6 +139,10 @@ class GetHostStatus(BaseResponse): + """ + status_code, host_infos = callback.get_host_ssh_info(params) + ++ result_list = [] ++ if len(host_infos) == 0: ++ return self.response(code=status_code, data=result_list) ++ + multi_thread_handler = MultiThreadHandler(lambda p: self.get_host_status(p), host_infos, None) + multi_thread_handler.create_thread() + result_list = multi_thread_handler.get_result() +@@ -457,13 +461,16 @@ def verify_ssh_login_info(ssh_login_info: ClientConnectArgs) -> str: + ) + client.close() + except socket.error as error: +- LOGGER.error(error) ++ LOGGER.info(f"Failed to connect to host %s: %s", ssh_login_info.host_ip, error) + return state.SSH_CONNECTION_ERROR + except SSHException as error: +- LOGGER.error(error) ++ LOGGER.info(f"Failed to connect to host %s: %s", ssh_login_info.host_ip, error) ++ return state.SSH_AUTHENTICATION_ERROR ++ except IndexError: ++ LOGGER.error(f"Failed to connect to host %s because the pkey of the host are missing", ssh_login_info.host_ip) + return state.SSH_AUTHENTICATION_ERROR + except Exception as error: +- LOGGER.error(error) ++ LOGGER.error(f"Failed to connect to host %s: %s", ssh_login_info.host_ip, error) + return state.SSH_CONNECTION_ERROR + + return state.SUCCEED +-- +Gitee + diff --git a/aops-zeus.spec b/aops-zeus.spec index c4cf981..5347e4b 100644 --- a/aops-zeus.spec +++ b/aops-zeus.spec @@ -1,6 +1,6 @@ Name: aops-zeus Version: v1.4.0 -Release: 4 +Release: 5 Summary: A host and user manager service which is the foundation of aops. License: MulanPSL2 URL: https://gitee.com/openeuler/%{name} @@ -13,6 +13,7 @@ Patch0005: 0005-fix-apollo-TimedCorrectTask.patch 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 BuildRequires: python3-setuptools @@ -53,6 +54,9 @@ cp -r database %{buildroot}/opt/aops/ %changelog +* Sun Dec 24 2023 luxuexian - v1.4.0-5 +- fix error log when query host status + * Thu Dec 21 2023 wenxin - v1.4.0-4 - update verification method for host ip field - check host status when query host detail -- Gitee