!22 [sync] PR-21: fix configparser.InterpolationSyntaxError

From: @openeuler-sync-bot 
Reviewed-by: @gaoruoshu 
Signed-off-by: @gaoruoshu
This commit is contained in:
openeuler-ci-bot 2024-09-11 03:29:21 +00:00 committed by Gitee
commit cbefd05b36
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 45 additions and 1 deletions

View File

@ -0,0 +1,37 @@
From 65ceade489c4018c3f315104d70be0550a28d9d9 Mon Sep 17 00:00:00 2001
From: shixuantong <shixuantong1@huawei.com>
Date: Wed, 11 Sep 2024 10:23:41 +0800
Subject: [PATCH] fix configparser.InterpolationSyntaxError
---
src/python/syssentry/sentry_config.py | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/python/syssentry/sentry_config.py b/src/python/syssentry/sentry_config.py
index 01f3df8..a0e7b79 100644
--- a/src/python/syssentry/sentry_config.py
+++ b/src/python/syssentry/sentry_config.py
@@ -103,14 +103,18 @@ class CpuPluginsParamsConfig:
"""read config file"""
config_param_section_args = {}
if os.path.exists(self.config_file):
- self.config.read(self.config_file)
try:
+ self.config.read(self.config_file)
config_param_section_args = dict(self.config[self.param_section_name])
- except (ValueError, KeyError):
+ except (ValueError, KeyError, configparser.InterpolationSyntaxError):
config_param_section_args = {}
+ logging.error("Failed to parse cpu_sentry.ini!")
return config_param_section_args
def join_cpu_start_cmd(self, cpu_param_dict: dict) -> str:
+ if not cpu_param_dict:
+ return ""
+
cpu_list = cpu_param_dict.get("cpu_list", "default")
if cpu_list == "default":
cpu_list = CpuPluginsParamsConfig.get_cpu_info()
--
2.27.0

View File

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