diff --git a/fix-ai-block-io-config-invalid.patch b/fix-ai-block-io-config-invalid.patch new file mode 100644 index 0000000000000000000000000000000000000000..08f03e560b4c130201932d5f79cf0e3bbb4effd8 --- /dev/null +++ b/fix-ai-block-io-config-invalid.patch @@ -0,0 +1,50 @@ +From b0e13503a6f91c2c3547168b84cf55abe0c224cd Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=E8=B4=BA=E6=9C=89=E5=BF=97?= <1037617413@qq.com> +Date: Wed, 9 Oct 2024 10:35:03 +0800 +Subject: [PATCH] fix ai block io config invalid + +--- + src/python/sentryPlugins/ai_block_io/README.md | 1 - + .../sentryPlugins/ai_block_io/config_parser.py | 12 +++++++++--- + 2 files changed, 9 insertions(+), 4 deletions(-) + +diff --git a/src/python/sentryPlugins/ai_block_io/README.md b/src/python/sentryPlugins/ai_block_io/README.md +index f9b8388..95c1111 100644 +--- a/src/python/sentryPlugins/ai_block_io/README.md ++++ b/src/python/sentryPlugins/ai_block_io/README.md +@@ -1,2 +1 @@ + # slow_io_detection +- +diff --git a/src/python/sentryPlugins/ai_block_io/config_parser.py b/src/python/sentryPlugins/ai_block_io/config_parser.py +index 632391d..1781e8f 100644 +--- a/src/python/sentryPlugins/ai_block_io/config_parser.py ++++ b/src/python/sentryPlugins/ai_block_io/config_parser.py +@@ -21,7 +21,9 @@ LOG_FORMAT = "%(asctime)s - %(levelname)s - [%(filename)s:%(lineno)d] - %(messag + + + def init_log_format(log_level: str): +- logging.basicConfig(level=get_log_level(log_level), format=LOG_FORMAT) ++ logging.basicConfig(level=get_log_level(log_level.lower()), format=LOG_FORMAT) ++ if log_level.lower() not in ('info', 'warning', 'error', 'debug'): ++ logging.warning(f'the log_level: {log_level} you set is invalid, use default value: info.') + + + class ConfigParser: +@@ -189,8 +191,12 @@ class ConfigParser: + + def read_config_from_file(self): + con = configparser.ConfigParser() +- con.read(self.__config_file_name, encoding='utf-8') +- ++ try: ++ con.read(self.__config_file_name, encoding='utf-8') ++ except configparser.Error as e: ++ logging.warning(f'config file read error: {e}, use default value.') ++ con = configparser.ConfigParser() ++ + if con.has_section('common'): + items_common = dict(con.items('common')) + self.__log_level = items_common.get('log_level', ConfigParser.DEFAULT_LOG_LEVEL) +-- +2.23.0 + diff --git a/sysSentry.spec b/sysSentry.spec index 44d549c8b8ccf06e85d083a3e0969b02c892df40..225e2141ecca65f53e5e24c93453af928fd18063 100644 --- a/sysSentry.spec +++ b/sysSentry.spec @@ -4,7 +4,7 @@ Summary: System Inspection Framework Name: sysSentry Version: 1.0.2 -Release: 21 +Release: 22 License: Mulan PSL v2 Group: System Environment/Daemons Source0: https://gitee.com/openeuler/sysSentry/releases/download/v%{version}/%{name}-%{version}.tar.gz @@ -33,6 +33,7 @@ Patch20: add-log-level-and-change-log-format.patch Patch21: fix-ai_block_io-some-issues.patch Patch22: add-pyxalarm-and-pySentryNotify-add-multi-users-supp.patch Patch23: add-sentryctl-get_alarm-module_name-s-time_range-d.patch +Patch24: fix-ai-block-io-config-invalid.patch BuildRequires: cmake gcc-c++ BuildRequires: python3 python3-setuptools @@ -275,6 +276,12 @@ rm -rf %{buildroot} %attr(0550,root,root) %{python3_sitelib}/sentryPlugins/ai_block_io %changelog +* Wed Oct 9 2024 heyouzhi - 1.0.2-22 +- Type:bugfix +- CVE:NA +- SUG:NA +- DESC:fix ai_block_io config invalid issues + * Tue Oct 8 2024 jinsaihang - 1.0.2-21 - Type:bugfix - CVE:NA