From a376c6eabd32d7bae2369516f28e55c4ad336ba5 Mon Sep 17 00:00:00 2001 From: rabbitali Date: Wed, 28 Jun 2023 12:26:34 +0800 Subject: [PATCH] fix issue:gen cve task failed (cherry picked from commit 8d27d5c5e3a72fc2f009372af0eef8cb0a385d8f) --- 0001-fix-issue-gen-cve-task-failed.patch | 28 ++++++++++++++++++++++++ aops-apollo.spec | 7 +++++- 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 0001-fix-issue-gen-cve-task-failed.patch diff --git a/0001-fix-issue-gen-cve-task-failed.patch b/0001-fix-issue-gen-cve-task-failed.patch new file mode 100644 index 0000000..d2ea7ac --- /dev/null +++ b/0001-fix-issue-gen-cve-task-failed.patch @@ -0,0 +1,28 @@ +From 614e6462e28c7ab013b669d7a7b2cc9c996a0a3f Mon Sep 17 00:00:00 2001 +From: rabbitali +Date: Wed, 28 Jun 2023 11:57:38 +0800 +Subject: [PATCH 1/1] fix issue:gen cve task failed + +--- + apollo/database/proxy/task.py | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/apollo/database/proxy/task.py b/apollo/database/proxy/task.py +index dd172b8..ed5e858 100644 +--- a/apollo/database/proxy/task.py ++++ b/apollo/database/proxy/task.py +@@ -3224,8 +3224,9 @@ class TaskProxy(TaskMysqlProxy, TaskEsProxy): + """ + + try: +- exists_cve_count = self.session.query(CveHostAssociation).filter( +- CveHostAssociation.cve_id.in_(cve_id)).count() ++ exists_cve_count = self.session.query(CveHostAssociation.cve_id).filter( ++ CveHostAssociation.cve_id.in_(cve_id)).distinct().count() ++ + + return True if exists_cve_count == len(cve_id) else False + except SQLAlchemyError as error: +-- +2.33.0 + diff --git a/aops-apollo.spec b/aops-apollo.spec index a75382e..e57c64d 100644 --- a/aops-apollo.spec +++ b/aops-apollo.spec @@ -1,10 +1,12 @@ Name: aops-apollo Version: v1.2.2 -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-issue-gen-cve-task-failed.patch + BuildRequires: python3-setuptools Requires: aops-vulcanus >= v1.2.0 @@ -75,6 +77,9 @@ cp -r hotpatch %{buildroot}/%{python3_sitelib}/dnf-plugins/ %{python3_sitelib}/aops_apollo_tool/* %changelog +* Wed Jun 28 2023 wenxin - v1.2.2-2 +- fix issue:gen cve task failed + * Tue Jun 20 2023 gongzhengtang - v1.2.2-1 - Fixes numerous known issues -- Gitee