From bdf56191e2b78cee6a720fc63a0750a3bc4321e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Mon, 22 Jun 2020 15:38:35 +0100 Subject: fix local deployment with sudo --- pkgs/krops/default.nix | 9 ++++++--- 1 file 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: { -- cgit v1.2.3