1
0
Fork 0
mirror of https://cgit.krebsco.de/krops synced 2024-12-23 02:09:51 +01:00

krops remoteCommand: don't ssh if target is local

This commit is contained in:
tv 2020-06-08 22:38:26 +02:00
parent 476fb97dc9
commit 67132ed53f

View file

@ -18,15 +18,18 @@ in
}";
remoteCommand = target: command:
writers.writeDash "build.${target.host}" ''
exec ${openssh}/bin/ssh ${lib.escapeShellArgs (lib.flatten [
(lib.optionals (target.user != "") ["-l" target.user])
"-p" target.port
"-t"
target.extraOptions
target.host
(if target.sudo then "sudo ${command}" else command)])}
'';
if lib.isLocalTarget target
then command
else
writers.writeDash "build.${target.host}" ''
exec ${openssh}/bin/ssh ${lib.escapeShellArgs (lib.flatten [
(lib.optionals (target.user != "") ["-l" target.user])
"-p" target.port
"-t"
target.extraOptions
target.host
(if target.sudo then "sudo ${command}" else command)])}
'';
writeCommand = name: {
command ? (targetPath: "echo ${targetPath}"),