diff options
author | Diana Picus <diana.picus@linaro.org> | 2020-10-23 10:33:46 +0200 |
---|---|---|
committer | Diana Picus <diana.picus@linaro.org> | 2020-10-23 10:33:46 +0200 |
commit | 746a31fe71b26c37d4ddbcee61d563fe3a2f5e75 (patch) | |
tree | ce324507c9dc0856c226f3e8d823993c6e95d838 /jenkins-helpers.sh | |
parent | 8b6fa8104783bf002ea5f756d60aeb5f09d1037e (diff) |
print_host_for_node: Make "ignore_fail" optional
We have at least one place (start-container-docker.sh) where
print_host_for_node is called with only one argument. This causes jobs
to fail with this error message: "$2: unbound variable".
This patch tries to address the issue by using the empty expansion if
the parameter is not set.
Change-Id: I0d695a136829cc819e5cfc487b34f0fa6bb370bc
Diffstat (limited to 'jenkins-helpers.sh')
-rw-r--r-- | jenkins-helpers.sh | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/jenkins-helpers.sh b/jenkins-helpers.sh index 9c0e796a..165edc99 100644 --- a/jenkins-helpers.sh +++ b/jenkins-helpers.sh @@ -172,6 +172,7 @@ print_type_for_label () } # $1: Jenkins $NODE_NAME +# $2: (optional) "ignore_fail" # Prints SSH host print_host_for_node () { @@ -190,7 +191,7 @@ print_host_for_node () host="" done - if [ x"$host" = x"" ] && [ x"$2" != x"ignore_fail" ]; then + if [ x"$host" = x"" ] && [ x"${2-}" != x"ignore_fail" ]; then echo "Error: print_host_for_node() cannot ssh to $1 or $1.tcwglab" >&2 exit 1 fi |