!71 [sync] PR-69: 修复任务创建失败的问题

From: @openeuler-sync-bot 
Reviewed-by: @zhu-yuncheng 
Signed-off-by: @zhu-yuncheng
This commit is contained in:
openeuler-ci-bot 2023-06-28 05:00:25 +00:00 committed by Gitee
commit c8cd423ec6
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
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