fix period task some bugs and fix env config

This commit is contained in:
shixuantong 2025-03-29 14:49:26 +08:00
parent 87260fb362
commit b1b02ba203
3 changed files with 89 additions and 1 deletions

View File

@ -0,0 +1,25 @@
From 8d6ca181b85ee32837e8891a1003d24826902f08 Mon Sep 17 00:00:00 2001
From: shixuantong <shixuantong1@huawei.com>
Date: Sat, 29 Mar 2025 10:58:17 +0800
Subject: [PATCH] fix env for subprocess.Popen
---
src/services/syssentry/global_values.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/services/syssentry/global_values.py b/src/services/syssentry/global_values.py
index 931b8ab..7cb99e0 100644
--- a/src/services/syssentry/global_values.py
+++ b/src/services/syssentry/global_values.py
@@ -76,7 +76,7 @@ class InspectTask:
# ccnfig env_file
self.env_file = ""
# env conf to popen arg
- self.environ_conf = {}
+ self.environ_conf = None
# start mode
self.conflict = "up"
# alarm id
--
2.27.0

View File

@ -0,0 +1,54 @@
From b0af4890cd131f33ab85708c75742f0a9680705c Mon Sep 17 00:00:00 2001
From: shixuantong <shixuantong1@huawei.com>
Date: Sat, 22 Mar 2025 10:38:30 +0800
Subject: [PATCH] fix period task some bugs
---
src/services/syssentry/cron_process.py | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/services/syssentry/cron_process.py b/src/services/syssentry/cron_process.py
index 204d4f3..fab350e 100644
--- a/src/services/syssentry/cron_process.py
+++ b/src/services/syssentry/cron_process.py
@@ -59,7 +59,6 @@ class PeriodTask(InspectTask):
self.result_info["details"] = {}
if not self.period_enabled:
self.period_enabled = True
- self.upgrade_period_timestamp()
if self.conflict != 'up':
ret = self.check_conflict()
@@ -87,6 +86,7 @@ class PeriodTask(InspectTask):
self.runtime_status = FAILED_STATUS
return False, "period task start popen failed, invalid command"
finally:
+ self.upgrade_period_timestamp()
if isinstance(logfile, io.TextIOWrapper) and not logfile.closed:
logfile.close()
@@ -127,7 +127,6 @@ class PeriodTask(InspectTask):
res, _ = self.start()
if res:
set_runtime_status(self.name, RUNNING_STATUS)
- self.upgrade_period_timestamp()
def period_tasks_handle():
@@ -142,7 +141,7 @@ def period_tasks_handle():
logging.debug("period not enabled")
continue
- if not task.onstart:
+ if not task.onstart and task.last_exec_timestamp == 0:
logging.debug("period onstart not enabled, task: %s", task.name)
task.runtime_status = EXITED_STATUS
continue
@@ -153,4 +152,3 @@ def period_tasks_handle():
res, _ = task.start()
if res:
set_runtime_status(task.name, RUNNING_STATUS)
- task.upgrade_period_timestamp()
--
2.27.0

View File

@ -4,7 +4,7 @@
Summary: System Inspection Framework
Name: sysSentry
Version: 1.0.3
Release: 9
Release: 10
License: Mulan PSL v2
Group: System Environment/Daemons
Source0: https://gitee.com/openeuler/sysSentry/releases/download/v%{version}/%{name}-%{version}.tar.gz
@ -17,6 +17,8 @@ Patch5: add-new-func-for-ebpf-in-the-rq_driver-stage.patch
Patch6: fix-the-sentryCollector-service-can-t-be-stopped-for.patch
Patch7: ai-block-io-exit-when-stage-is-not-supported.patch
Patch8: add-log-utils-for-c.patch
Patch9: fix-env-for-subprocess.Popen.patch
Patch10: fix-period-task-some-bugs.patch
BuildRequires: cmake gcc-c++
BuildRequires: python3 python3-setuptools
@ -215,6 +217,13 @@ rm -rf /var/run/sysSentry | :
%attr(0550,root,root) %{python3_sitelib}/syssentry/bmc_alarm.py
%changelog
* Sat Mar 29 2025 shixuantong <shixuantong1@huawei.com> - 1.0.3-10
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC:fix period task some bugs
fix env_file and environ_conf
* Fri Mar 14 2025 shixuantong <shixuantong1@huawei.com> - 1.0.3-9
- Type:bugfix
- CVE:NA