Merge pull request #438 from darko-poljak/bugfix-ssh-mux-controlpath-too-long
Bugfix: ssh mux controlpath too long on some envs.
This commit is contained in:
commit
4d43ab07bc
1 changed files with 6 additions and 3 deletions
|
@ -26,8 +26,11 @@ def inspect_ssh_mux_opts(control_path_dir="~/.ssh/"):
|
||||||
import subprocess
|
import subprocess
|
||||||
import os
|
import os
|
||||||
|
|
||||||
control_path = os.path.join(control_path_dir,
|
# socket is always local to each cdist run, it is created in
|
||||||
"cdist.socket.master-%l-%r@%h:%p")
|
# 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 = {
|
wanted_mux_opts = {
|
||||||
"ControlPath": control_path,
|
"ControlPath": control_path,
|
||||||
"ControlMaster": "auto",
|
"ControlMaster": "auto",
|
||||||
|
@ -147,7 +150,7 @@ def commandline():
|
||||||
# didn't specify command line options nor env vars:
|
# didn't specify command line options nor env vars:
|
||||||
# inspect multiplexing options for default cdist.REMOTE_COPY/EXEC
|
# inspect multiplexing options for default cdist.REMOTE_COPY/EXEC
|
||||||
if args_dict['remote_copy'] is None or args_dict['remote_exec'] is None:
|
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
|
import atexit
|
||||||
atexit.register(lambda: shutil.rmtree(control_path_dir))
|
atexit.register(lambda: shutil.rmtree(control_path_dir))
|
||||||
mux_opts = inspect_ssh_mux_opts(control_path_dir)
|
mux_opts = inspect_ssh_mux_opts(control_path_dir)
|
||||||
|
|
Loading…
Reference in a new issue