From e38ab65f3692b83661318a22d8a6964a1ff22139 Mon Sep 17 00:00:00 2001 From: yunchao Date: Tue, 10 Dec 2024 17:12:04 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=B6=85=E5=A4=A7=E8=AE=A2=E9=98=85?= =?UTF-8?q?=E6=96=B9=E6=A1=88=20(closed=20#2429)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/backend/components/collections/base.py | 5 +++-- apps/backend/subscription/steps/plugin.py | 13 ++++++++----- apps/backend/subscription/tasks.py | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/apps/backend/components/collections/base.py b/apps/backend/components/collections/base.py index 19247d4ff..b47961fc5 100644 --- a/apps/backend/components/collections/base.py +++ b/apps/backend/components/collections/base.py @@ -341,7 +341,6 @@ class BaseService(Service, LogMixin, DBHelperMixin, PollingTimeoutMixin): failed_subscription_instance_id_reason_map: Optional[Dict[int, Any]] = None # 日志制作类实例 log_maker: Optional[LogMaker] = None - # is_multi_paralle_gateway: bool = False def __init__(self, *args, **kwargs): self.failed_subscription_instance_id_reason_map: Dict = {} @@ -686,7 +685,9 @@ def inputs_format(self): ), Service.InputItem(name="subscription_step_id", key="subscription_step_id", type="int", required=True), Service.InputItem(name="blueking_language", key="blueking_language", type="str", required=True), - Service.InputItem(name="is_multi_paralle_gateway", key="is_multi_paralle_gateway", type="bool", required=True), + Service.InputItem( + name="is_multi_paralle_gateway", key="is_multi_paralle_gateway", type="bool", required=True + ), ] def outputs_format(self): diff --git a/apps/backend/subscription/steps/plugin.py b/apps/backend/subscription/steps/plugin.py index 1a6a14d25..f0b923b86 100644 --- a/apps/backend/subscription/steps/plugin.py +++ b/apps/backend/subscription/steps/plugin.py @@ -383,7 +383,7 @@ def handle_uninstall_instances( def handle_new_add_instances( self, install_action: str, - instances: RedisDict, + instances: Union[RedisDict, Dict[str, Dict]], instance_actions: Dict[str, str], bk_host_id__host_map: Dict[int, models.Host], group_id__host_key__proc_status_map: Dict[str, Dict[str, models.ProcessStatus]], @@ -441,7 +441,7 @@ def handle_exceed_max_retry_times_instances( def handle_manual_op_instances( self, - instances: RedisDict, + instances: Union[RedisDict, Dict[str, Dict]], instance_actions: Dict[str, str], auto_trigger: bool, push_migrate_reason_func: Callable, @@ -492,7 +492,10 @@ def handle_manual_op_instances( ) def handle_not_change_instances( - self, instances: RedisDict, migrate_reasons: Dict[str, Dict], push_migrate_reason_func: Callable + self, + instances: Union[RedisDict, Dict[str, Dict]], + migrate_reasons: Dict[str, Dict], + push_migrate_reason_func: Callable, ): """ 处理无需变更实例,请在最后调用该钩子 @@ -584,7 +587,7 @@ def handle_check_and_skip_instances( instance_actions: Dict[str, str], push_migrate_reason_func: Callable, bk_host_id__host_map: Dict[int, models.Host], - instances: RedisDict, + instances: Union[RedisDict, Dict[str, Dict]], ): """ 插件状态及版本检查,确定是否执行安装 @@ -714,7 +717,7 @@ def get_action_dict(self) -> Dict[str, str]: def make_instances_migrate_actions( self, - instances: RedisDict, + instances: Union[RedisDict, Dict[str, Dict]], auto_trigger: bool = False, preview_only: bool = False, **kwargs, diff --git a/apps/backend/subscription/tasks.py b/apps/backend/subscription/tasks.py index 255621686..c626c6c9c 100644 --- a/apps/backend/subscription/tasks.py +++ b/apps/backend/subscription/tasks.py @@ -374,7 +374,7 @@ def wrapper(subscription: models.Subscription, subscription_task: models.Subscri def create_task( subscription: models.Subscription, subscription_task: models.SubscriptionTask, - instances: RedisDict, + instances: Union[RedisDict, Dict[str, Dict]], instance_actions: Dict[str, Dict[str, str]], preview_only: bool = False, data_backend: str = None,