Projects
Eulaceura:Factory
aops-apollo
_service:obs_scm:0004-fix-repo-query-error-and-...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:obs_scm:0004-fix-repo-query-error-and-adjust-schema.patch of Package aops-apollo
From fde9a0d9ed3b3ad99fdde047d9b8928e97e9af2f Mon Sep 17 00:00:00 2001 From: rabbitali <wenxin32@foxmail.com> Date: Sat, 7 Sep 2024 16:52:45 +0800 Subject: [PATCH 1/1] Fixed the error of the repo query interface; Adaptable to Copilot adjustments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apollo/database/proxy/task/base.py | 1 + apollo/function/schema/cve.py | 2 +- apollo/function/schema/host.py | 4 +++- apollo/function/schema/repo.py | 1 - apollo/function/schema/task.py | 4 +++- apollo/handler/repo_handler/view.py | 15 ++------------- 6 files changed, 10 insertions(+), 17 deletions(-) diff --git a/apollo/database/proxy/task/base.py b/apollo/database/proxy/task/base.py index 8d86614..3f9a0ba 100644 --- a/apollo/database/proxy/task/base.py +++ b/apollo/database/proxy/task/base.py @@ -504,6 +504,7 @@ class TaskMysqlProxy(MysqlProxy): "takeover": row.takeover, "cluster_id": row.cluster_id, "cluster_name": cluster_dict_info.get(row.cluster_id), + "task_type": row.task_type, } return task_info diff --git a/apollo/function/schema/cve.py b/apollo/function/schema/cve.py index b5a0270..4a18916 100644 --- a/apollo/function/schema/cve.py +++ b/apollo/function/schema/cve.py @@ -89,7 +89,7 @@ class CveTaskHostSchemaOfCveInfo(Schema): """ cve_id = fields.String(required=True, validate=lambda s: 0 < len(s) <= 20) - rpms = fields.List(fields.Nested(PackageInfoSchema), required=True) + rpms = fields.List(fields.Nested(PackageInfoSchema), required=False, missing=[]) class GetCveTaskHostSchema(Schema): diff --git a/apollo/function/schema/host.py b/apollo/function/schema/host.py index bccdb65..684a55c 100644 --- a/apollo/function/schema/host.py +++ b/apollo/function/schema/host.py @@ -37,7 +37,9 @@ class ScanHostSchema(Schema): validators for parameter of /vulnerability/host/scan """ - host_list = fields.List(fields.String(validate=lambda s: 0 < len(s) <= 36, required=True), required=True) + host_list = fields.List( + fields.String(validate=lambda s: 0 < len(s) <= 36, required=True), required=False, missing=[] + ) filter = fields.Nested(ScanHostFilterSchema, required=False) diff --git a/apollo/function/schema/repo.py b/apollo/function/schema/repo.py index bdd4c3d..618470f 100644 --- a/apollo/function/schema/repo.py +++ b/apollo/function/schema/repo.py @@ -34,7 +34,6 @@ class GetYumRepoSchema(Schema): """ repo_id_list = fields.List(fields.String(validate=lambda s: 0 < len(s) <= 36), required=False) - search_key = fields.String(required=False, validate=lambda s: 0 < len(s) <= 32) class UpdateYumRepoSchema(Schema): diff --git a/apollo/function/schema/task.py b/apollo/function/schema/task.py index f306cea..be116ad 100644 --- a/apollo/function/schema/task.py +++ b/apollo/function/schema/task.py @@ -93,7 +93,9 @@ class GenerateCveTaskSchema(Schema): task_name = fields.String(required=True, validate=lambda s: 0 < len(s) <= 20) description = fields.String(required=True, validate=lambda s: 0 < len(s) <= 100) accepted = fields.Boolean(required=True, validate=validate.OneOf([True, False])) - check_items = fields.List(fields.String(required=True, validate=lambda s: 0 < len(s) <= 32), required=False) + check_items = fields.List( + fields.String(required=True, validate=lambda s: 0 < len(s) <= 32), required=False, missing=[] + ) takeover = fields.Boolean(required=True, validate=validate.OneOf([True, False])) info = fields.List(fields.Nested(CveInfoDictSchema), required=True, validate=lambda s: len(s) > 0) diff --git a/apollo/handler/repo_handler/view.py b/apollo/handler/repo_handler/view.py index 6a06c1d..6909e24 100644 --- a/apollo/handler/repo_handler/view.py +++ b/apollo/handler/repo_handler/view.py @@ -93,21 +93,10 @@ class VulGetYumRepo(BaseResponse): Query repo info handle """ cluster_info_dic = cache.get_user_clusters() - if cluster_info_dic is None: - return DATABASE_QUERY_ERROR, [] - - cluster_list = [] - if params.get("search_key"): - for cluster_id, info in cluster_info_dic.items(): - if params.get("search_key") in info.get("cluster_name"): - cluster_list.append(cluster_id) - else: - cluster_list = list(cluster_info_dic.keys()) - - if not cluster_list: + if not cluster_info_dic: return SUCCEED, [] - status_code, result = proxy.get_repo(params.get("repo_id_list", []), cluster_list) + status_code, result = proxy.get_repo(params.get("repo_id_list", []), list(cluster_info_dic.keys())) if status_code != SUCCEED: return status_code, [] -- 2.33.0
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2