aboutsummaryrefslogtreecommitdiffstats
path: root/pkgs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2020-06-22 20:57:21 +0200
committerGitHub <noreply@github.com>2020-06-22 20:57:21 +0200
commit3e731035ed44659624e6d00bbb35570f2b8811fd (patch)
tree36a1b42e734be42ec71c2a16d27b50d6abf40353 /pkgs
parent56a066d4705f6f9f28b713e5f8a50a6596063dce (diff)
parentbdf56191e2b78cee6a720fc63a0750a3bc4321e1 (diff)
Merge pull request #20 from Mic92/local-sudov1.22.1
fix local deployment with sudo
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/krops/default.nix9
1 files changed, 6 insertions, 3 deletions
diff --git a/pkgs/krops/default.nix b/pkgs/krops/default.nix
index ab74bc3..184a12a 100644
--- a/pkgs/krops/default.nix
+++ b/pkgs/krops/default.nix
@@ -18,8 +18,11 @@ in
}";
runShell = target: command:
- if lib.isLocalTarget target
- then command
+ let
+ command' = if target.sudo then "sudo ${command}" else command;
+ in
+ if lib.isLocalTarget target
+ then command'
else
writers.writeDash "krops.${target.host}.${lib.firstWord command}" ''
exec ${openssh}/bin/ssh ${lib.escapeShellArgs (lib.flatten [
@@ -28,7 +31,7 @@ in
"-T"
target.extraOptions
target.host
- (if target.sudo then "sudo ${command}" else command)])}
+ command'])}
'';
writeCommand = name: {