Bugfix: ssh mux controlpath too long on some envs.

Darko Poljak 2016-06-03 12:11:31 +02:00
parent ab74da9c29
commit 8246642a45
1 changed files with 6 additions and 3 deletions

View File

@ -26,8 +26,11 @@ def inspect_ssh_mux_opts(control_path_dir="~/.ssh/"):
import subprocess
import os
control_path = os.path.join(control_path_dir,
# socket is always local to each cdist run, it is created in
# temp directory that is created at starting cdist, so
# control_path file name can be static, it will always be
# unique due to unique temp directory name
control_path = os.path.join(control_path_dir, "ssh-control-path")
wanted_mux_opts = {
"ControlPath": control_path,
"ControlMaster": "auto",
@ -147,7 +150,7 @@ def commandline():
# didn't specify command line options nor env vars:
# inspect multiplexing options for default cdist.REMOTE_COPY/EXEC
if args_dict['remote_copy'] is None or args_dict['remote_exec'] is None:
control_path_dir = tempfile.mkdtemp()
control_path_dir = tempfile.mkdtemp(prefix="cdist")
import atexit
atexit.register(lambda: shutil.rmtree(control_path_dir))
mux_opts = inspect_ssh_mux_opts(control_path_dir)