diff options
| author | Joey Hess <joey@kitenet.net> | 2014-11-22 16:06:44 -0400 |
|---|---|---|
| committer | Joey Hess <joey@kitenet.net> | 2014-11-22 16:06:44 -0400 |
| commit | 392a0d3c1cc175161cd0c6d82b098e92d6adf9e6 (patch) | |
| tree | ed59269ad54da8fd66179beaa47c2d3b76709f5b /src/Propellor/Ssh.hs | |
| parent | 6d13790afa236b958eec9e8a0ea1e75125d90351 (diff) | |
propellor spin
Diffstat (limited to 'src/Propellor/Ssh.hs')
| -rw-r--r-- | src/Propellor/Ssh.hs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/Propellor/Ssh.hs b/src/Propellor/Ssh.hs index 969517a8..ecdb54d2 100644 --- a/src/Propellor/Ssh.hs +++ b/src/Propellor/Ssh.hs @@ -14,15 +14,17 @@ import Data.Time.Clock.POSIX -- minutes, and if so stop that ssh process, in order to not try to -- use an old stale connection. (atime would be nicer, but there's -- a good chance a laptop uses noatime) -sshCachingParams :: HostName -> IO [CommandParam] -sshCachingParams hn = do +sshCachingParams :: HostName -> Bool -> IO [CommandParam] +sshCachingParams hn viarelay = do home <- myHomeDir let cachedir = home </> ".ssh" </> "propellor" createDirectoryIfMissing False cachedir let socketfile = cachedir </> hn ++ ".sock" - let ps = - [ Param "-o", Param ("ControlPath=" ++ socketfile) - , Params "-o ControlMaster=auto -o ControlPersist=yes" + let ps = catMaybes + [ if viarelay then Just (Param "-A") else Nothing + , Just $ Param "-o" + , Just $ Param ("ControlPath=" ++ socketfile) + , Just $ Params "-o ControlMaster=auto -o ControlPersist=yes" ] maybe noop (expireold ps socketfile) |
