!150 fix bug with host count in cve fix task

From: @rabbitali 
Reviewed-by: @Lostwayzxc 
Signed-off-by: @Lostwayzxc
This commit is contained in:
openeuler-ci-bot 2024-07-24 02:43:15 +00:00 committed by Gitee
commit 1cf199a375
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 31 additions and 1 deletions

View File

@ -0,0 +1,26 @@
From a82cceada0df66cf48d646a3cd6a55556ebf9962 Mon Sep 17 00:00:00 2001
From: rabbitali <wenxin32@foxmail.com>
Date: Tue, 23 Jul 2024 18:55:50 +0800
Subject: [PATCH 1/1] fix bug with host count in cve fix task
---
apollo/database/proxy/task/cve_fix.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/apollo/database/proxy/task/cve_fix.py b/apollo/database/proxy/task/cve_fix.py
index fa3f2a9..1aa5546 100644
--- a/apollo/database/proxy/task/cve_fix.py
+++ b/apollo/database/proxy/task/cve_fix.py
@@ -121,7 +121,8 @@ class CveFixTaskProxy(TaskProxy):
wait_fix_rpms = dict()
for task_info in fix_host_rpm_info:
- wait_fix_rpms[task_info["cve_id"]] = dict(rpms=task_info.get("rpms", []), hosts=list(host_dict.keys()))
+ host_list = [host_info["host_id"] for host_info in task_info["host_info"]]
+ wait_fix_rpms[task_info["cve_id"]] = dict(rpms=task_info.get("rpms", []), hosts=host_list)
hotpatch_fix_rpms, coldpatch_fix_rpms = self._get_cold_and_hotpatch_fix_rpm(wait_fix_rpms, data["takeover"])
fix_tasks = []
--
2.33.0

View File

@ -1,11 +1,12 @@
Name: aops-apollo
Version: v2.0.0
Release: 2
Release: 3
Summary: Cve management service, monitor machine vulnerabilities and provide fix functions.
License: MulanPSL2
URL: https://gitee.com/openeuler/%{name}
Source0: %{name}-%{version}.tar.gz
Patch0001: 0001-fix-security-advisory-parsing-error.patch
Patch0002: 0002-fix-bug-with-host-count-in-cve-fix-task.patch
BuildRequires: python3-setuptools
Requires: aops-vulcanus >= v2.0.0
@ -63,6 +64,9 @@ popd
%{python3_sitelib}/aops_apollo_tool/*
%changelog
* Tue Jul 23 2024 wenxin<wenxin32@foxmail.com> - v2.0.0-3
- fix bug with host count in cve fix task
* Fri Jul 19 2024 wenxin<wenxin32@foxmail.com> - v2.0.0-2
- fix security advisory parsing error