summaryrefslogtreecommitdiffstats
path: root/pkgs/populate
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2019-11-29 00:01:37 +0100
committertv <tv@krebsco.de>2019-11-29 13:21:04 +0100
commit70fa39607fa9f0d7df424588ae109968f0f876d1 (patch)
treec8e912bca0edb372d2669e7ad1e65ab08fd5d76a /pkgs/populate
parent8de797dae0fcd1821d79c486abeffc536c2de643 (diff)
ssh: support using ssh-configured 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.nix12
1 files changed, 7 insertions, 5 deletions
diff --git a/pkgs/populate/default.nix b/pkgs/populate/default.nix
index 8a383b1..2b283a8 100644
--- a/pkgs/populate/default.nix
+++ b/pkgs/populate/default.nix
@@ -163,8 +163,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
@@ -180,13 +182,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