From 135c15d12743acbfca7cb0cc3b5245ee662c2aeb Mon Sep 17 00:00:00 2001 From: Eric Date: Mon, 30 Jan 2023 14:42:42 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E5=8F=91=E5=B8=83?= =?UTF-8?q?=E6=9C=BA=E5=88=9D=E5=A7=8B=E5=8C=96=E9=83=A8=E7=BD=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/terminal/models/applet/host.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apps/terminal/models/applet/host.py b/apps/terminal/models/applet/host.py index 37d15e64d..e179a8380 100644 --- a/apps/terminal/models/applet/host.py +++ b/apps/terminal/models/applet/host.py @@ -114,6 +114,13 @@ class AppletHostDeployment(JMSBaseModel): ordering = ('-date_start',) def start(self, **kwargs): + # 重新初始化部署,applet host 关联的终端需要删除 + # 否则 tinker 会因终端注册名称相同,造成冲突,执行任务失败 + if self.host.terminal: + terminal = self.host.terminal + self.host.terminal = None + self.host.save() + terminal.delete() from ...automations.deploy_applet_host import DeployAppletHostManager manager = DeployAppletHostManager(self) manager.run(**kwargs)