fix issue:gen cve task failed

(cherry picked from commit 8d27d5c5e3a72fc2f009372af0eef8cb0a385d8f)
This commit is contained in:
rabbitali 2023-06-28 12:26:34 +08:00 committed by openeuler-sync-bot
parent c429f81d53
commit a376c6eabd
2 changed files with 34 additions and 1 deletions

View File

@ -0,0 +1,28 @@
From 614e6462e28c7ab013b669d7a7b2cc9c996a0a3f Mon Sep 17 00:00:00 2001
From: rabbitali <shusheng.wen@outlook.com>
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

View File

@ -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<shusheng.wen@outlook.com> - v1.2.2-2
- fix issue:gen cve task failed
* Tue Jun 20 2023 gongzhengtang<gong_zhengtang@163.com> - v1.2.2-1
- Fixes numerous known issues