diff --git a/0005-fix-apollo-TimedCorrectTask.patch b/0005-fix-apollo-TimedCorrectTask.patch new file mode 100644 index 0000000000000000000000000000000000000000..4c7a26f6b5e0c3327f85774a4ce24a464b32f2ee --- /dev/null +++ b/0005-fix-apollo-TimedCorrectTask.patch @@ -0,0 +1,27 @@ +From cb3af79a8237c6b7e083dc8ba7d324bddf395e08 Mon Sep 17 00:00:00 2001 +From: rearcher <123781007@qq.com> +Date: Tue, 19 Dec 2023 10:59:30 +0800 +Subject: [PATCH] fix apollo TimedCorrectTask + +--- + zeus/database/proxy/host.py | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/zeus/database/proxy/host.py b/zeus/database/proxy/host.py +index 441ef21..471390e 100644 +--- a/zeus/database/proxy/host.py ++++ b/zeus/database/proxy/host.py +@@ -372,7 +372,9 @@ class HostProxy(MysqlProxy): + Host.pkey, + Host.ssh_user, + ] +- filters = {Host.user == username} ++ filters = set() ++ if username: ++ filters = {Host.user == username} + if host_list: + filters.add(Host.host_id.in_(host_list)) + try: +-- +Gitee + diff --git a/0006-update-verification-method-for-adding-host.patch b/0006-update-verification-method-for-adding-host.patch new file mode 100644 index 0000000000000000000000000000000000000000..3b9bd6f60057c6e88910585168bb407aa0461851 --- /dev/null +++ b/0006-update-verification-method-for-adding-host.patch @@ -0,0 +1,70 @@ +From 82cd9883bbf5fc95ca1bd38c36a8a2066aeaa4a1 Mon Sep 17 00:00:00 2001 +From: rabbitali +Date: Tue, 19 Dec 2023 11:02:31 +0800 +Subject: [PATCH] update verification method for adding host or updating host + info + +--- + zeus/function/verify/host.py | 25 +++++++++++++++---------- + 1 file changed, 15 insertions(+), 10 deletions(-) + +diff --git a/zeus/function/verify/host.py b/zeus/function/verify/host.py +index 461fc12..310373c 100644 +--- a/zeus/function/verify/host.py ++++ b/zeus/function/verify/host.py +@@ -16,9 +16,7 @@ Author: + Description: For host related interfaces + """ + from vulcanus.restful.serialize.validate import ValidateRules +-from marshmallow import Schema +-from marshmallow import fields +-from marshmallow import validate ++from marshmallow import fields, Schema, validate, validates_schema, ValidationError + + + class HostSchema(Schema): +@@ -111,7 +109,7 @@ class AddHostSchema(Schema): + validators for parameter of /manage/host/add + """ + +- ssh_user = fields.String(required=True, validate=lambda s: len(s) > 0) ++ ssh_user = fields.String(required=True, validate=lambda s: 32 >= len(s) > 0) + password = fields.String(required=True, allow_none=True, validate=lambda s: len(s) >= 0) + host_name = fields.String( + required=True, validate=[validate.Length(min=1, max=50), ValidateRules.space_character_check] +@@ -119,8 +117,13 @@ class AddHostSchema(Schema): + host_ip = fields.IP(required=True) + ssh_pkey = fields.String(required=True, allow_none=True, validate=lambda s: 4096 >= len(s) >= 0) + ssh_port = fields.Integer(required=True, validate=lambda s: 65535 >= s > 0) +- host_group_name = fields.String(required=True, validate=lambda s: len(s) > 0) +- management = fields.Boolean(required=True) ++ host_group_name = fields.String(required=True, validate=lambda s: 20 >= len(s) > 0) ++ management = fields.Boolean(required=True, truthy={True}, falsy={False}) ++ ++ @validates_schema ++ def check_authentication_info(self, data, **kwargs): ++ if not data.get("ssh_pkey") and not data.get("password"): ++ raise ValidationError("At least one of the password and key needs to be provided") + + + class AddHostBatchSchema(Schema): +@@ -137,10 +140,12 @@ class UpdateHostSchema(Schema): + """ + + host_id = fields.Integer(required=True, validate=lambda s: s > 0) +- ssh_user = fields.String(required=False, validate=lambda s: len(s) > 0) ++ ssh_user = fields.String(required=False, validate=lambda s: 32 >= len(s) > 0) + password = fields.String(required=False, validate=lambda s: len(s) > 0) + ssh_port = fields.Integer(required=False, validate=lambda s: 65535 >= s > 0) +- host_name = fields.String(required=False, validate=lambda s: len(s) > 0) +- host_group_name = fields.String(required=False, validate=lambda s: len(s) > 0) +- management = fields.Boolean(required=False) ++ host_name = fields.String( ++ required=True, validate=[validate.Length(min=1, max=50), ValidateRules.space_character_check] ++ ) ++ host_group_name = fields.String(required=False, validate=lambda s: 20 >= len(s) > 0) ++ management = fields.Boolean(required=False, truthy={True}, falsy={False}) + ssh_pkey = fields.String(required=False, validate=lambda s: 4096 >= len(s) >= 0) +-- +2.33.0 + diff --git a/aops-zeus.spec b/aops-zeus.spec index 13d86f144d403f805d7c170560be024af9bf4dc3..bb33c0558d848762a86f016bc0116358c4e2bd4e 100644 --- a/aops-zeus.spec +++ b/aops-zeus.spec @@ -1,6 +1,6 @@ Name: aops-zeus Version: v1.4.0 -Release: 2 +Release: 3 Summary: A host and user manager service which is the foundation of aops. License: MulanPSL2 URL: https://gitee.com/openeuler/%{name} @@ -9,6 +9,8 @@ Patch0001: 0001-add-interface-for-detecting-host-status.patch Patch0002: 0002-update-the-query-host-list-api.patch Patch0003: 0003-fix-search_key-validate.patch Patch0004: 0004-add-rollback-task-execution-method.patch +Patch0005: 0005-fix-apollo-TimedCorrectTask.patch +Patch0006: 0006-update-verification-method-for-adding-host.patch BuildRequires: python3-setuptools @@ -49,6 +51,10 @@ cp -r database %{buildroot}/opt/aops/ %changelog +* Tue Dec 19 2023 luxuexian - v1.4.0-3 +- fix apollo TimedCorrectTask. +- update verification method for adding host. + * Mon Dec 18 2023 wenxin - v1.4.0-2 - Add interface for detecting host status. - Update query host list api, add a new query method based on host name for it.