update cve fix

This commit is contained in:
wenxin 2022-12-07 18:00:20 +08:00
parent dc1edb1683
commit 77b4995b80
2 changed files with 64 additions and 1 deletions

59
0002-update-cve-fix.patch Normal file
View File

@ -0,0 +1,59 @@
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

View File

@ -1,11 +1,12 @@
Name: aops-ceres
Version: v1.1.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.
License: MulanPSL2
URL: https://gitee.com/openeuler/%{name}
Source0: %{name}-%{version}.tar.gz
Patch0001: 0001-update-register.patch
Patch0002: 0002-update-cve-fix.patch
BuildRequires: python3-setuptools
Requires: python3-requests python3-flask python3-connexion python3-configparser python3-jsonschema
@ -42,6 +43,9 @@ An agent which needs to be adopted in client, it managers some plugins, such as
%changelog
* Wed Dec 07 2022 wenxin<shusheng.wen@outlook.com> - v1.1.0-3
- update cve fix
* Wed Dec 07 2022 wenxin<shusheng.wen@outlook.com> - v1.1.0-2
- modify args of register func, add register file template