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 --- sysSentry-1.0.2/src/python/syssentry/cpu_sentry.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sysSentry-1.0.2/src/python/syssentry/cpu_sentry.py b/sysSentry-1.0.2/src/python/syssentry/cpu_sentry.py index d0bafa8..9287e2f 100644 --- a/sysSentry-1.0.2/src/python/syssentry/cpu_sentry.py +++ b/sysSentry-1.0.2/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 = [] -- Gitee