summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--krops.nix10
1 files changed, 7 insertions, 3 deletions
diff --git a/krops.nix b/krops.nix
index dfa2121d..9997895b 100644
--- a/krops.nix
+++ b/krops.nix
@@ -166,10 +166,14 @@ rec {
q = lib.escapeShellArg;
nix = "nix --extra-experimental-features nix-command";
jq = "${pkgs.jq}/bin/jq";
+ # A port is digits, so it needs no quoting in ssh's options.
+ sshOptsOf = s: t:
+ assert lib.assertMsg (t.port == null || lib.match "[0-9]+" t.port != null)
+ "${name}: ${s}: port ${t.port} isn't a number";
+ lib.optionalString (t.port != null) "-p ${t.port}";
targetDest =
lib.optionalString (target'.user != null) "${target'.user}@" + target'.host;
- targetSSHOpts =
- lib.optionalString (target'.port != null) "-p ${target'.port}";
+ targetSSHOpts = sshOptsOf target target';
targetURL = "${spec.targetStore}://${targetDest}";
# The builders, as targets like populate's, [USER@]HOST[:PORT]/PATH:
# PATH is where a builder keeps the GC roots of the systems it builds,
@@ -184,7 +188,7 @@ rec {
"${name}: copyVia = \"deployer\" can't use ports for both ${s} and the target";
{
dest = lib.optionalString (t.user != null) "${t.user}@" + t.host;
- sshOpts = lib.optionalString (t.port != null) "-p ${t.port}";
+ sshOpts = sshOptsOf s t;
inherit (t) path;
}) spec.builders;
targetSource = lib.evalSource [ targetSources ];