fix: 修复自动化任务重包含多个playbook runtime 目录被提前删除的问题

pull/13052/head
Aaron3S 7 months ago committed by Bryan
parent 29dbc2e4d4
commit 6f2d04a029

@ -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:

@ -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()

Loading…
Cancel
Save