diff --git a/fix-result-when-process-output-is-None.patch b/fix-result-when-process-output-is-None.patch new file mode 100644 index 0000000000000000000000000000000000000000..9d227001f40da876af90c8b47a011d2d5b1de0a1 --- /dev/null +++ b/fix-result-when-process-output-is-None.patch @@ -0,0 +1,36 @@ +From e8e4fa5fd9e78508567782e17b7b1cb6ace3ef0d Mon Sep 17 00:00:00 2001 +From: shixuantong +Date: Fri, 26 Jul 2024 15:59:42 +0800 +Subject: [PATCH] fix result when process output is None + +--- + src/python/syssentry/cpu_sentry.py | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/src/python/syssentry/cpu_sentry.py b/src/python/syssentry/cpu_sentry.py +index d0bafa8..9287e2f 100644 +--- a/src/python/syssentry/cpu_sentry.py ++++ b/src/python/syssentry/cpu_sentry.py +@@ -87,11 +87,19 @@ class CpuSentry: + } + + def handle_cpu_output(self, stdout: str): ++ if not stdout: ++ logging.error("%s process output is None, it may be killed!", LOW_LEVEL_INSPECT_CMD) ++ self.send_result["result"] = ResultLevel.FAIL ++ self.send_result["details"]["code"] = 1005 ++ self.send_result["details"]["msg"] = "cpu_sentry task is killed!" ++ return ++ + if "ERROR" in stdout: + self.send_result["result"] = ResultLevel.FAIL + self.send_result["details"]["code"] = 1004 + self.send_result["details"]["msg"] = stdout.split("\n")[0] + return ++ + out_split = stdout.split("\n") + isolated_cores_number = 0 + found_fault_cores_list = [] +-- +2.27.0 + diff --git a/sysSentry.spec b/sysSentry.spec index 6bc93aa697247438b607619533ca30368071fa81..3f63cc016129dd97f3a6c9cd5c0eaa66010987ef 100644 --- a/sysSentry.spec +++ b/sysSentry.spec @@ -4,7 +4,7 @@ Summary: System Inspection Framework Name: sysSentry Version: 1.0.2 -Release: 3 +Release: 4 License: Mulan PSL v2 Group: System Environment/Daemons Source0: https://gitee.com/openeuler/sysSentry/releases/download/v%{version}/%{name}-%{version}.tar.gz @@ -13,6 +13,7 @@ BuildRoot: %{_builddir}/%{name}-root Patch1: fix-version-in-setup.py.patch Patch2: Fix-the-problem-that-function-cpu_report_result-is-c.patch Patch3: fix-error-handling.patch +Patch4: fix-result-when-process-output-is-None.patch BuildRequires: cmake gcc-c++ BuildRequires: python3 python3-setuptools @@ -169,6 +170,12 @@ rm -rf %{buildroot} %attr(0550,root,root) %{python3_sitelib}/syssentry/cpu_* %changelog +* Fri Jul 26 2024 shixuantong - 1.0.2-4 +- Type:bugfix +- CVE:NA +- SUG:NA +- DESC:fix result when process output is None + * Thu Jul 25 2024 shixuantong - 1.0.2-3 - Type:bugfix - CVE:NA