fix hotpatch fail show succeed bug
(cherry picked from commit 0e33fe6d370d9daad867b5ae447482be3f75b346)
This commit is contained in:
parent
b135a081c4
commit
5c53587331
51
0002-fix-hotpatch-fail-show-succeed-bug.patch
Normal file
51
0002-fix-hotpatch-fail-show-succeed-bug.patch
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
From af168dfd4886d994060af0d3a17f417d7d08daa2 Mon Sep 17 00:00:00 2001
|
||||||
|
From: young <954906362@qq.com>
|
||||||
|
Date: Tue, 9 May 2023 11:07:47 +0800
|
||||||
|
Subject: [PATCH] fix hotpatch fail show succeed bug
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
---
|
||||||
|
ceres/manages/vulnerability_manage.py | 14 ++++++++++----
|
||||||
|
1 file changed, 10 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/ceres/manages/vulnerability_manage.py b/ceres/manages/vulnerability_manage.py
|
||||||
|
index 12c3bc1..a353dab 100644
|
||||||
|
--- a/ceres/manages/vulnerability_manage.py
|
||||||
|
+++ b/ceres/manages/vulnerability_manage.py
|
||||||
|
@@ -151,8 +151,10 @@ class VulnerabilityManage:
|
||||||
|
scan_result = get_shell_data(
|
||||||
|
["dnf", "updateinfo", "list", "cves", "--repo", repo_id])
|
||||||
|
is_dnf_command = False
|
||||||
|
-
|
||||||
|
- for scan_info in scan_result.strip().split("\n")[2:]:
|
||||||
|
+ # scan_result e.g.
|
||||||
|
+ # Last metadata expiration check: 4:31:51 ago on Tue 09 May 2023 05:50:28 AM CST.
|
||||||
|
+ # CVE-2021-32675 Low/sec.- -
|
||||||
|
+ for scan_info in scan_result.strip().split("\n")[1:]:
|
||||||
|
cve = re.findall(r"CVE-[\d]{4}-[\d]+", scan_info)[0]
|
||||||
|
result_list.append({
|
||||||
|
"cve_id": cve,
|
||||||
|
@@ -221,7 +223,8 @@ class VulnerabilityManage:
|
||||||
|
command_execute_result: output from command execution
|
||||||
|
|
||||||
|
"""
|
||||||
|
- if cve.get("hotpatch"):
|
||||||
|
+ hotpatch = cve.get("hotpatch")
|
||||||
|
+ if hotpatch:
|
||||||
|
commond_args = ["dnf", "hotupgrade",
|
||||||
|
f"--cve={cve.get('cve_id')}", "-y"]
|
||||||
|
else:
|
||||||
|
@@ -233,4 +236,7 @@ class VulnerabilityManage:
|
||||||
|
LOGGER.error(f"Failed to fix cve {cve.get('cve_id')} by dnf")
|
||||||
|
res = 'Host has no command dnf'
|
||||||
|
|
||||||
|
- return "Apply hot patch succeed" in res or "Complete" in res, res
|
||||||
|
+ if hotpatch:
|
||||||
|
+ return "Apply hot patch succeed" in res, res
|
||||||
|
+ else:
|
||||||
|
+ return "Complete" in res, res
|
||||||
|
--
|
||||||
|
Gitee
|
||||||
|
|
||||||
@ -1,11 +1,12 @@
|
|||||||
Name: aops-ceres
|
Name: aops-ceres
|
||||||
Version: v1.2.0
|
Version: v1.2.0
|
||||||
Release: 2
|
Release: 3
|
||||||
Summary: An agent which needs to be adopted in client, it managers some plugins, such as gala-gopher(kpi collection), fluentd(log collection) and so on.
|
Summary: An agent which needs to be adopted in client, it managers some plugins, such as gala-gopher(kpi collection), fluentd(log collection) and so on.
|
||||||
License: MulanPSL2
|
License: MulanPSL2
|
||||||
URL: https://gitee.com/openeuler/%{name}
|
URL: https://gitee.com/openeuler/%{name}
|
||||||
Source0: %{name}-%{version}.tar.gz
|
Source0: %{name}-%{version}.tar.gz
|
||||||
Patch0001: 0001-fix-shell-command-return-error-and-update-register-function.patch
|
Patch0001: 0001-fix-shell-command-return-error-and-update-register-function.patch
|
||||||
|
Patch0002: 0002-fix-hotpatch-fail-show-succeed-bug.patch
|
||||||
|
|
||||||
BuildRequires: python3-setuptools
|
BuildRequires: python3-setuptools
|
||||||
Requires: python3-requests python3-jsonschema python3-libconf
|
Requires: python3-requests python3-jsonschema python3-libconf
|
||||||
@ -40,6 +41,9 @@ An agent which needs to be adopted in client, it managers some plugins, such as
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue May 9 2023 ptyang<1475324955@qq.com> - v1.2.0-3
|
||||||
|
- fix hotpatch fail show succeed bug
|
||||||
|
|
||||||
* Thu Apr 27 2023 wenixn<shusheng.wen@outlook.com> - v1.2.0-2
|
* Thu Apr 27 2023 wenixn<shusheng.wen@outlook.com> - v1.2.0-2
|
||||||
- fix shell command return error;update registe funciton
|
- fix shell command return error;update registe funciton
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user