aops-ceres/0002-update-cve-fix.patch
2022-12-07 18:10:35 +08:00

60 lines
1.9 KiB
Diff

From 861fa75e32d7abbd8bb348145c3902e3bdc04b80 Mon Sep 17 00:00:00 2001
From: wenxin <shusheng.wen@outlook.com>
Date: Wed, 7 Dec 2022 17:02:40 +0800
Subject: [PATCH] update cve fix
---
ceres/function/status.py | 2 +-
ceres/manages/vulnerability_manage.py | 13 ++++++++++---
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/ceres/function/status.py b/ceres/function/status.py
index 1e93526..8664b4d 100644
--- a/ceres/function/status.py
+++ b/ceres/function/status.py
@@ -61,7 +61,7 @@ class StatusCode:
"msg": "repo content cannot parse by yum"
},
REPO_NOT_SET: {
- "msg": "repo source named update is not set"
+ "msg": "repo source named aops-update is not set"
}
}
diff --git a/ceres/manages/vulnerability_manage.py b/ceres/manages/vulnerability_manage.py
index b3cebed..d4d25e2 100644
--- a/ceres/manages/vulnerability_manage.py
+++ b/ceres/manages/vulnerability_manage.py
@@ -21,7 +21,8 @@ from ceres.function.status import (
REPO_CONTENT_INCORRECT,
REPO_NOT_SET,
SERVICE_NOT_EXIST,
- SUCCESS
+ SUCCESS,
+ StatusCode
)
from ceres.function.util import get_shell_data
from ceres.models.custom_exception import InputError
@@ -149,10 +150,16 @@ class VulnerabilityManage:
}]
"""
+ result_list = []
if not self._validate_repo_source(REPO_ID_FOR_CVE_MANAGE):
- return REPO_NOT_SET, []
+ for cve in cves:
+ result_list.append({
+ "cve_id": cve,
+ "log": StatusCode.mapping.get(REPO_NOT_SET).get('msg'),
+ "result": 'fail'
+ })
+ return REPO_NOT_SET, result_list
- result_list = []
for cve in cves:
command_execute_result = self._fix_cve_by_yum(cve)
result = {
--
2.37.1.windows.1