Merge pull request #113190 from BenTheElder/shell-fixups

assorted small shell script fixes
This commit is contained in:
Kubernetes Prow Robot
2022-10-20 03:34:57 -07:00
committed by GitHub
8 changed files with 30 additions and 20 deletions

View File

@@ -18,11 +18,12 @@
# A set of helpers for tests
readonly reset=$(tput sgr0)
readonly bold=$(tput bold)
readonly black=$(tput setaf 0)
readonly red=$(tput setaf 1)
readonly green=$(tput setaf 2)
reset=$(tput sgr0)
bold=$(tput bold)
black=$(tput setaf 0)
red=$(tput setaf 1)
green=$(tput setaf 2)
readonly reset bold black red green
kube::test::clear_all() {
if kube::test::if_supports_resource "rc" ; then

View File

@@ -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.