From 6f2d04a029b8f76750333cffc40e5ba1c197bc4a Mon Sep 17 00:00:00 2001 From: Aaron3S Date: Thu, 18 Apr 2024 12:39:23 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96=E4=BB=BB=E5=8A=A1=E9=87=8D=E5=8C=85=E5=90=AB=E5=A4=9A?= =?UTF-8?q?=E4=B8=AAplaybook=20runtime=20=E7=9B=AE=E5=BD=95=E8=A2=AB?= =?UTF-8?q?=E6=8F=90=E5=89=8D=E5=88=A0=E9=99=A4=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/assets/automations/base/manager.py | 1 + apps/ops/ansible/receptor/receptor_runner.py | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/assets/automations/base/manager.py b/apps/assets/automations/base/manager.py index 653ccd9b2..d94e5583c 100644 --- a/apps/assets/automations/base/manager.py +++ b/apps/assets/automations/base/manager.py @@ -333,6 +333,7 @@ class BasePlaybookManager: ssh_tunnel = SSHTunnelManager() ssh_tunnel.local_gateway_prepare(runner) try: + kwargs.update({"clean_workspace": False}) cb = runner.run(**kwargs) self.on_runner_success(runner, cb) except Exception as e: diff --git a/apps/ops/ansible/receptor/receptor_runner.py b/apps/ops/ansible/receptor/receptor_runner.py index 3c493bd3c..de07859ae 100644 --- a/apps/ops/ansible/receptor/receptor_runner.py +++ b/apps/ops/ansible/receptor/receptor_runner.py @@ -58,6 +58,7 @@ class AnsibleReceptorRunner(WorkPostRunCleaner): def __init__(self, **kwargs): self.runner_params = kwargs self.unit_id = None + self.clean_workspace = kwargs.pop("clean_workspace", True) def write_unit_id(self): if not self.unit_id: @@ -69,6 +70,8 @@ class AnsibleReceptorRunner(WorkPostRunCleaner): @property def clean_dir(self): + if not self.clean_workspace: + return None return self.runner_params.get("private_data_dir", None) @cleanup_post_run @@ -78,7 +81,7 @@ class AnsibleReceptorRunner(WorkPostRunCleaner): with concurrent.futures.ThreadPoolExecutor(max_workers=1) as executor: transmitter_future = executor.submit(self.transmit, input) result = receptor_ctl.submit_work(payload=output.makefile('rb'), - node='primary', worktype='ansible-runner') + node='primary', worktype='ansible-runner') input.close() output.close()