Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ssh: Read extra options from NIXOPS_SSHOPTS env var. #1174

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion nixops/ssh_util.py
Expand Up @@ -43,12 +43,16 @@ def __init__(self, target, logger, ssh_flags, passwd, user, compress=False):
kwargs['preexec_fn'] = os.setsid
pass_prompts = 1

# Allow the user to provide some extra SSH flags via an env var.
env_flags = shlex.split(os.getenv('NIXOPS_SSHOPTS', default =""))

cmd = ["ssh", "-x", self._ssh_target, "-S",
self._control_socket, "-M", "-N", "-f",
'-oNumberOfPasswordPrompts={0}'.format(pass_prompts),
'-oServerAliveInterval=60',
'-oControlPersist=600'] \
+ (["-C"] if compress else [])
+ (["-C"] if compress else []) \
+ env_flags

res = subprocess.call(cmd + ssh_flags, **kwargs)
if res != 0:
Expand Down