From 6875f8f6dbe2f7b08cf6a447057bfd4514b83537 Mon Sep 17 00:00:00 2001 From: gongzhengtang 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 --- 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