diff options
author | tv <tv@krebsco.de> | 2019-11-29 00:01:37 +0100 |
---|---|---|
committer | tv <tv@krebsco.de> | 2019-11-29 00:09:26 +0100 |
commit | d9d3c5072ae69357d88d0edfda5ca816d3ff96ae (patch) | |
tree | dd9688abf7c7ebc96da55e4736fd9fbc769f0e84 /pkgs/populate | |
parent | 2e94e6eb24eec23075e5925f8de7468b3489d4fb (diff) |
ssh: support using ssh-configured useroptional-ssh-user
Let ssh use the user configured in its configuration files when the
target user is set to the empty string.
Closes https://github.com/krebs/krops/issues/2
Diffstat (limited to 'pkgs/populate')
-rw-r--r-- | pkgs/populate/default.nix | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/pkgs/populate/default.nix b/pkgs/populate/default.nix index 1367a50..f78aa4a 100644 --- a/pkgs/populate/default.nix +++ b/pkgs/populate/default.nix @@ -162,8 +162,10 @@ let --delete-excluded \ "$source_path" \ ${quote ( - optionalString (!isLocalTarget target) - "${target.user}@${target.host}:" + + optionalString (!isLocalTarget target) ( + (optionalString (target.user != "") "${target.user}@") + + "${target.host}:" + ) + target.path )} \ >&2 @@ -176,13 +178,13 @@ let ${ssh' target} ${quote target.host} ${quote script} ''; - ssh' = target: concatMapStringsSep " " quote [ + ssh' = target: concatMapStringsSep " " quote (flatten [ "${openssh}/bin/ssh" - "-l" target.user + (optionals (target.user != "") ["-l" target.user]) "-o" "ControlPersist=no" "-p" target.port "-T" - ]; + ]); in |