From 72d035879151887aaf3a4c536b3f4d00c5c7751f Mon Sep 17 00:00:00 2001 From: rearcher <123781007@qq.com> Date: Mon, 18 Dec 2023 23:00:30 +0800 Subject: [PATCH] fix cve_list sort order (cherry picked from commit 1ce33f72486fc1d5fa47332ed09c9791bd7a6213) --- 0001-fix-cve-list-sort.patch | 30 ++++++++++++++++++++++++++++++ aops-apollo.spec | 8 ++++++-- 2 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 0001-fix-cve-list-sort.patch diff --git a/0001-fix-cve-list-sort.patch b/0001-fix-cve-list-sort.patch new file mode 100644 index 0000000..41b17aa --- /dev/null +++ b/0001-fix-cve-list-sort.patch @@ -0,0 +1,30 @@ +From b87c51761b3143aabd39a3e9c91596e540325172 Mon Sep 17 00:00:00 2001 +From: rearcher <123781007@qq.com> +Date: Mon, 18 Dec 2023 22:24:51 +0800 +Subject: [PATCH] fix cve_list sort + +--- + apollo/database/proxy/cve.py | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/apollo/database/proxy/cve.py b/apollo/database/proxy/cve.py +index e92cb14..6210156 100644 +--- a/apollo/database/proxy/cve.py ++++ b/apollo/database/proxy/cve.py +@@ -669,10 +669,11 @@ class CveProxy(CveMysqlProxy, CveEsProxy): + sort_page['limt_size'] = int(per_page) + + # sort by host num by default ++ sort_page["order_by"] = data.get("direction", "asc") + sort_page["order_by_filed"] = data.get('sort', "cve_id") + if sort_page["order_by_filed"] == "host_num": +- sort_page["order_by_filed"] = "cve_id, host_num" +- sort_page["order_by"] = data.get("direction", "asc") ++ sort_page["order_by_filed"] = f"host_num {sort_page['order_by']},cve_id " ++ + return sort_page + + def _query_cve_list(self, data): +-- +Gitee + diff --git a/aops-apollo.spec b/aops-apollo.spec index 2984542..feb5062 100644 --- a/aops-apollo.spec +++ b/aops-apollo.spec @@ -1,10 +1,11 @@ Name: aops-apollo Version: v1.4.1 -Release: 1 +Release: 2 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-cve-list-sort.patch BuildRequires: python3-setuptools Requires: aops-vulcanus >= v1.3.0 @@ -27,7 +28,7 @@ Requires: python3-rpm smalltools for aops-apollo, e.g.updateinfo.xml generater %prep -%autosetup -n %{name}-%{version} +%autosetup -n %{name}-%{version} -p1 # build for aops-apollo @@ -67,6 +68,9 @@ popd %{python3_sitelib}/aops_apollo_tool/* %changelog +* Mon Dec 18 2023 luxuexian - v1.4.1-2 +- fix cve_list sort order + * Mon Dec 18 2023 wenxin - v1.4.1-1 - Add support for CVE rollback tasks - Optimize the code and adjust the project structure -- Gitee