From 63986c15018c94f2cee12e6d0add607d4c9ea474 Mon Sep 17 00:00:00 2001 From: yksitu <1297650644@qq.com> Date: Mon, 28 Oct 2024 18:05:10 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dtbinlogdumper=E6=B5=81?= =?UTF-8?q?=E7=A8=8B=E4=B8=80=E4=BA=9B=E9=97=AE=E9=A2=98=20#7616?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../db_meta/api/cluster/tendbha/handler.py | 3 +- .../tbinlogdumper/common/common_sub_flow.py | 51 ++++++------------- 2 files changed, 16 insertions(+), 38 deletions(-) diff --git a/dbm-ui/backend/db_meta/api/cluster/tendbha/handler.py b/dbm-ui/backend/db_meta/api/cluster/tendbha/handler.py index bf2d0694c8..f34700c587 100644 --- a/dbm-ui/backend/db_meta/api/cluster/tendbha/handler.py +++ b/dbm-ui/backend/db_meta/api/cluster/tendbha/handler.py @@ -24,7 +24,6 @@ from backend.db_package.models import Package from backend.flow.consts import MediumEnum from backend.flow.engine.bamboo.scene.common.get_real_version import get_mysql_real_version, get_proxy_real_version -from backend.flow.utils.base.cc_topo_operate import CCTopoOperator from backend.flow.utils.cc_manage import CcManage from backend.flow.utils.mysql.mysql_module_operate import MysqlCCTopoOperator from backend.flow.utils.tbinlogdumper.tbinlogdumper_module_operate import TBinlogDumperCCTopoOperator @@ -243,7 +242,7 @@ def switch_tbinlogdumper_for_cluster(self, switch_ids: list): inst.save() # 创建新的服务实例 - CCTopoOperator(cluster=self.cluster).create_tbinlogdumper_instances(inst) + TBinlogDumperCCTopoOperator(cluster=self.cluster).create_tbinlogdumper_instances(inst) @classmethod @transaction.atomic() diff --git a/dbm-ui/backend/flow/engine/bamboo/scene/tbinlogdumper/common/common_sub_flow.py b/dbm-ui/backend/flow/engine/bamboo/scene/tbinlogdumper/common/common_sub_flow.py index 7b6570b0a6..4341acb86f 100644 --- a/dbm-ui/backend/flow/engine/bamboo/scene/tbinlogdumper/common/common_sub_flow.py +++ b/dbm-ui/backend/flow/engine/bamboo/scene/tbinlogdumper/common/common_sub_flow.py @@ -18,7 +18,6 @@ from backend.db_meta.models import Cluster, Machine from backend.db_meta.models.extra_process import ExtraProcessInstance from backend.flow.consts import DBA_SYSTEM_USER -from backend.flow.engine.bamboo.scene.common.atom_jobs.set_dns_sub_job import set_dns_atom_job from backend.flow.engine.bamboo.scene.common.builder import SubBuilder from backend.flow.engine.bamboo.scene.common.get_file_list import GetFileList from backend.flow.engine.bamboo.scene.mysql.common.common_sub_flow import build_repl_by_manual_input_sub_flow @@ -35,7 +34,6 @@ from backend.flow.plugins.components.collections.tbinlogdumper.trans_backup_file import TBinlogDumperTransFileComponent from backend.flow.utils.mysql.mysql_act_dataclass import DownloadMediaKwargs, ExecActuatorKwargs, P2PFileKwargs from backend.flow.utils.mysql.mysql_act_playload import MysqlActPayload -from backend.flow.utils.redis.redis_context_dataclass import ActKwargs from backend.flow.utils.tbinlogdumper.context_dataclass import StopSlaveKwargs, TBinlogDumperFullSyncDataKwargs from backend.flow.utils.tbinlogdumper.tbinlogdumper_act_payload import TBinlogDumperActPayload @@ -83,14 +81,14 @@ def add_tbinlogdumper_sub_flow( sub_pipeline = SubBuilder(root_id=root_id, data=parent_global_data) # 初始化机器,为了安装tbinlogdumper - sub_pipeline.add_sub_pipeline( - sub_flow=init_machine_sub_flow( - root_id=root_id, - uid=uid, - init_machine=master.machine, - is_install_l5_agent=is_install_l5_agent, + if is_install_l5_agent: + sub_pipeline.add_sub_pipeline( + sub_flow=init_machine_sub_flow( + root_id=root_id, + uid=uid, + init_machine=master.machine, + ) ) - ) # 阶段1 并行分发安装文件 sub_pipeline.add_act( @@ -484,7 +482,6 @@ def init_machine_sub_flow( uid: str, root_id: str, init_machine: Machine, - is_install_l5_agent: bool, ): """ 定义安装tbinlogdumper之前初始化内容 @@ -494,37 +491,19 @@ def init_machine_sub_flow( @param uid: 单据uid @param root_id: 主流程的root_id @param init_machine: 需要初始化的机器对象 - @param is_install_l5_agent: 是否安装L5 agent """ # 声明子流程 parent_global_data = {"uid": uid} sub_pipeline = SubBuilder(root_id=root_id, data=parent_global_data) - if is_install_l5_agent: - sub_pipeline.add_act( - act_name=_("安装L5agent"), - act_component_code=L5AgentInstallComponent.code, - kwargs={ - "ip": init_machine.ip, - "bk_host_id": init_machine.bk_host_id, - }, - ) - - else: - sub_pipeline.add_sub_pipeline( - set_dns_atom_job( - root_id=root_id, - ticket_data=parent_global_data, - act_kwargs=ActKwargs(), - param={ - "force": False, - "ip": init_machine.ip, - "bk_biz_id": init_machine.bk_biz_id, - "bk_cloud_id": init_machine.bk_cloud_id, - "bk_city": init_machine.bk_city.logical_city.name, - }, - ) - ) + sub_pipeline.add_act( + act_name=_("安装L5agent"), + act_component_code=L5AgentInstallComponent.code, + kwargs={ + "ip": init_machine.ip, + "bk_host_id": init_machine.bk_host_id, + }, + ) # 返回子流程 return sub_pipeline.build_sub_process(sub_name=_("初始化tbinlogdumper机器"))