aops-ceres/0005-match-correctly-applied-hotpatchs.patch
rabbitali b6bb02c514 更新patch0005
(cherry picked from commit 78d1706c42522f68f4c15d3be35a216a9a417d00)
2023-06-30 20:52:24 +08:00

40 lines
1.6 KiB
Diff

From 6875f8f6dbe2f7b08cf6a447057bfd4514b83537 Mon Sep 17 00:00:00 2001
From: gongzhengtang <gong_zhengtang@163.com>
Date: Fri, 30 Jun 2023 11:09:24 +0000
Subject: [PATCH] Match the correctly applied hot patches
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: gongzhengtang <gong_zhengtang@163.com>
---
ceres/manages/vulnerability_manage.py | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/ceres/manages/vulnerability_manage.py b/ceres/manages/vulnerability_manage.py
index 8547abe..cfecb60 100644
--- a/ceres/manages/vulnerability_manage.py
+++ b/ceres/manages/vulnerability_manage.py
@@ -429,14 +429,11 @@ class VulnerabilityManage:
if status_code == FAIL or not re.search("base-pkg/hotpatch", hotpatch_list_output):
return None
- for hotpatch_info in [line for line in hotpatch_list_output.split(os.linesep) if line]:
- if not hotpatch_info.startswith("CVE"):
- continue
- _, hot_pkg, _, = [info.strip() for info in hotpatch_info.split()]
- if hot_pkg == "base-pkg/hotpatch":
- continue
- return hot_pkg
- return ""
+ for hotpatch_info in [line for line in hotpatch_list_output.split(os.linesep) if line.startswith("CVE")]:
+ _, hot_pkg, status = hotpatch_info.strip().split()
+ if status in ("ACTIVED", "ACCEPTED"):
+ return hot_pkg
+ return None
def _syscare_operate(self, operate, patch_name=None):
"""
--
Gitee