diff options
author | tv <tv@krebsco.de> | 2020-06-22 20:57:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-22 20:57:21 +0200 |
commit | 3e731035ed44659624e6d00bbb35570f2b8811fd (patch) | |
tree | 36a1b42e734be42ec71c2a16d27b50d6abf40353 | |
parent | 56a066d4705f6f9f28b713e5f8a50a6596063dce (diff) | |
parent | bdf56191e2b78cee6a720fc63a0750a3bc4321e1 (diff) |
Merge pull request #20 from Mic92/local-sudo
fix local deployment with sudo
-rw-r--r-- | pkgs/krops/default.nix | 9 |
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: { |