From 94c0ec317b2fc425527903b7ae467f037b3db0e2 Mon Sep 17 00:00:00 2001 From: Benjamin Elder Date: Wed, 19 Oct 2022 12:14:43 -0700 Subject: [PATCH] Don't assign DOCKER an array in hack/lib/util.sh DOCKER is otherwise used to be the command name (perhaps podman), but we were conflating DOCKER_OPTS in kube::util::ensure_docker_daemon_connectivity. Split out docker opts. This fixes shellcheck warning that docker is assigned an array and then a string in some scripts. --- hack/lib/util.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/hack/lib/util.sh b/hack/lib/util.sh index fba83b2fa82..02cf4e3aa7d 100755 --- a/hack/lib/util.sh +++ b/hack/lib/util.sh @@ -603,11 +603,9 @@ function kube::util::list_staging_repos() { # Determines if docker can be run, failures may simply require that the user be added to the docker group. function kube::util::ensure_docker_daemon_connectivity { - IFS=" " read -ra DOCKER <<< "${DOCKER_OPTS}" - # Expand ${DOCKER[@]} only if it's not unset. This is to work around - # Bash 3 issue with unbound variable. - DOCKER=(docker ${DOCKER[@]:+"${DOCKER[@]}"}) - if ! "${DOCKER[@]}" info > /dev/null 2>&1 ; then + DOCKER_OPTS=${DOCKER_OPTS:-""} + IFS=" " read -ra docker_opts <<< "${DOCKER_OPTS}" + if ! docker "${docker_opts[@]:+"${docker_opts[@]}"}" info > /dev/null 2>&1 ; then cat <<'EOF' >&2 Can't connect to 'docker' daemon. please fix and retry.