fix syssentry fails to be started when cpu_sentry is not installed

This commit is contained in:
zhuofeng 2024-09-14 09:45:31 +08:00
parent cbefd05b36
commit 284ff94c8b
2 changed files with 64 additions and 1 deletions

View File

@ -0,0 +1,56 @@
From 497b3124f017ce4ae99b34261c4fd5dd2a358f5b Mon Sep 17 00:00:00 2001
From: zhuofeng <zhuofeng2@huawei.com>
Date: Sat, 14 Sep 2024 09:28:00 +0800
Subject: [PATCH] fix syssentry fails to be started when cpu_sentry is not
installed
---
src/python/syssentry/syssentry.py | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/python/syssentry/syssentry.py b/src/python/syssentry/syssentry.py
index f93956e..776971f 100644
--- a/src/python/syssentry/syssentry.py
+++ b/src/python/syssentry/syssentry.py
@@ -43,7 +43,6 @@ try:
from .cpu_alarm import cpu_alarm_recv
except ImportError:
CPU_EXIST = False
- logging.debug("Cannot find cpu sentry mod")
INSPECTOR = None
@@ -563,20 +562,21 @@ def main():
if not os.path.exists(SENTRY_RUN_DIR):
os.mkdir(SENTRY_RUN_DIR)
os.chmod(SENTRY_RUN_DIR, mode=SENTRY_RUN_DIR_PERM)
- if not chk_and_set_pidfile():
- logging.error("get pid file lock failed, exist")
- sys.exit(17)
logging.basicConfig(filename=SYSSENTRY_LOG_FILE, level=logging.INFO)
os.chmod(SYSSENTRY_LOG_FILE, 0o600)
+ if not chk_and_set_pidfile():
+ logging.error("get pid file lock failed, exist")
+ sys.exit(17)
+
try:
signal.signal(signal.SIGINT, sig_handler)
signal.signal(signal.SIGTERM, sig_handler)
signal.signal(signal.SIGHUP, sig_handler)
signal.signal(signal.SIGCHLD, sigchld_handler)
- logging.debug("finish main parse_args")
+ logging.info("finish main parse_args")
_ = SentryConfig.init_param()
TasksMap.init_task_map()
@@ -587,3 +587,4 @@ def main():
logging.error('%s', traceback.format_exc())
finally:
release_pidfile()
+
--
2.33.0

View File

@ -4,7 +4,7 @@
Summary: System Inspection Framework
Name: sysSentry
Version: 1.0.2
Release: 11
Release: 12
License: Mulan PSL v2
Group: System Environment/Daemons
Source0: https://gitee.com/openeuler/sysSentry/releases/download/v%{version}/%{name}-%{version}.tar.gz
@ -21,6 +21,7 @@ Patch8: add-deleted-code-to-plugin-rasdaemon.patch
Patch9: Remove-ANSI-escape-sequences.patch
Patch10: split-cpu_sentry-and-syssentry.patch
Patch11: fix-configparser.InterpolationSyntaxError.patch
Patch12: fix-syssentry-fails-to-be-started-when-cpu_sentry-is.patch
BuildRequires: cmake gcc-c++
BuildRequires: python3 python3-setuptools
@ -178,6 +179,12 @@ rm -rf %{buildroot}
%attr(0550,root,root) %{python3_sitelib}/syssentry/cpu_*
%changelog
* Sat Sep 14 2024 zhuofeng <zhuofeng2@huawei.com> - 1.0.2-12
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC:fix syssentry fails to be started when cpu_sentry is not installed
* Wed Sep 11 2024 shixuantong <shixuantong1@huawei.com> - 1.0.2-11
- Type:bugfix
- CVE:NA