Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid using which, CoreOS doesn't always have it #5795

Merged
merged 2 commits into from
Sep 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions pkg/model/resources/nodeup.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,20 @@ download-or-bust() {

if [[ -e "${file}" ]]; then
echo "== File exists for ${url} =="
elif [[ $(which curl) ]]; then

# CoreOS runs this script in a container without which (but has curl)
# Note also that busybox wget doesn't support wget --version, but busybox doesn't normally have curl
# So we default to wget unless we see curl
elif [[ $(curl --version) ]]; then
if ! curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10 "${url}"; then
echo "== Failed to curl ${url}. Retrying. =="
break
fi
elif [[ $(which wget ) ]]; then
else
if ! wget --inet4-only -O "${file}" --connect-timeout=20 --tries=6 --wait=10 "${url}"; then
echo "== Failed to wget ${url}. Retrying. =="
break
fi
else
echo "== Could not find curl or wget. Retrying. =="
break
fi

if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then
Expand Down
11 changes: 6 additions & 5 deletions pkg/model/tests/data/bootstrapscript_0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,20 @@ download-or-bust() {

if [[ -e "${file}" ]]; then
echo "== File exists for ${url} =="
elif [[ $(which curl) ]]; then

# CoreOS runs this script in a container without which (but has curl)
# Note also that busybox wget doesn't support wget --version, but busybox doesn't normally have curl
# So we default to wget unless we see curl
elif [[ $(curl --version) ]]; then
if ! curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10 "${url}"; then
echo "== Failed to curl ${url}. Retrying. =="
break
fi
elif [[ $(which wget ) ]]; then
else
if ! wget --inet4-only -O "${file}" --connect-timeout=20 --tries=6 --wait=10 "${url}"; then
echo "== Failed to wget ${url}. Retrying. =="
break
fi
else
echo "== Could not find curl or wget. Retrying. =="
break
fi

if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then
Expand Down
11 changes: 6 additions & 5 deletions pkg/model/tests/data/bootstrapscript_1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,20 @@ download-or-bust() {

if [[ -e "${file}" ]]; then
echo "== File exists for ${url} =="
elif [[ $(which curl) ]]; then

# CoreOS runs this script in a container without which (but has curl)
# Note also that busybox wget doesn't support wget --version, but busybox doesn't normally have curl
# So we default to wget unless we see curl
elif [[ $(curl --version) ]]; then
if ! curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10 "${url}"; then
echo "== Failed to curl ${url}. Retrying. =="
break
fi
elif [[ $(which wget ) ]]; then
else
if ! wget --inet4-only -O "${file}" --connect-timeout=20 --tries=6 --wait=10 "${url}"; then
echo "== Failed to wget ${url}. Retrying. =="
break
fi
else
echo "== Could not find curl or wget. Retrying. =="
break
fi

if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then
Expand Down
11 changes: 6 additions & 5 deletions pkg/model/tests/data/bootstrapscript_2.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,20 @@ download-or-bust() {

if [[ -e "${file}" ]]; then
echo "== File exists for ${url} =="
elif [[ $(which curl) ]]; then

# CoreOS runs this script in a container without which (but has curl)
# Note also that busybox wget doesn't support wget --version, but busybox doesn't normally have curl
# So we default to wget unless we see curl
elif [[ $(curl --version) ]]; then
if ! curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10 "${url}"; then
echo "== Failed to curl ${url}. Retrying. =="
break
fi
elif [[ $(which wget ) ]]; then
else
if ! wget --inet4-only -O "${file}" --connect-timeout=20 --tries=6 --wait=10 "${url}"; then
echo "== Failed to wget ${url}. Retrying. =="
break
fi
else
echo "== Could not find curl or wget. Retrying. =="
break
fi

if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then
Expand Down
11 changes: 6 additions & 5 deletions pkg/model/tests/data/bootstrapscript_3.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,20 @@ download-or-bust() {

if [[ -e "${file}" ]]; then
echo "== File exists for ${url} =="
elif [[ $(which curl) ]]; then

# CoreOS runs this script in a container without which (but has curl)
# Note also that busybox wget doesn't support wget --version, but busybox doesn't normally have curl
# So we default to wget unless we see curl
elif [[ $(curl --version) ]]; then
if ! curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10 "${url}"; then
echo "== Failed to curl ${url}. Retrying. =="
break
fi
elif [[ $(which wget ) ]]; then
else
if ! wget --inet4-only -O "${file}" --connect-timeout=20 --tries=6 --wait=10 "${url}"; then
echo "== Failed to wget ${url}. Retrying. =="
break
fi
else
echo "== Could not find curl or wget. Retrying. =="
break
fi

if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then
Expand Down
11 changes: 6 additions & 5 deletions pkg/model/tests/data/bootstrapscript_4.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,20 @@ download-or-bust() {

if [[ -e "${file}" ]]; then
echo "== File exists for ${url} =="
elif [[ $(which curl) ]]; then

# CoreOS runs this script in a container without which (but has curl)
# Note also that busybox wget doesn't support wget --version, but busybox doesn't normally have curl
# So we default to wget unless we see curl
elif [[ $(curl --version) ]]; then
if ! curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10 "${url}"; then
echo "== Failed to curl ${url}. Retrying. =="
break
fi
elif [[ $(which wget ) ]]; then
else
if ! wget --inet4-only -O "${file}" --connect-timeout=20 --tries=6 --wait=10 "${url}"; then
echo "== Failed to wget ${url}. Retrying. =="
break
fi
else
echo "== Could not find curl or wget. Retrying. =="
break
fi

if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then
Expand Down
11 changes: 6 additions & 5 deletions pkg/model/tests/data/bootstrapscript_5.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,20 @@ download-or-bust() {

if [[ -e "${file}" ]]; then
echo "== File exists for ${url} =="
elif [[ $(which curl) ]]; then

# CoreOS runs this script in a container without which (but has curl)
# Note also that busybox wget doesn't support wget --version, but busybox doesn't normally have curl
# So we default to wget unless we see curl
elif [[ $(curl --version) ]]; then
if ! curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10 "${url}"; then
echo "== Failed to curl ${url}. Retrying. =="
break
fi
elif [[ $(which wget ) ]]; then
else
if ! wget --inet4-only -O "${file}" --connect-timeout=20 --tries=6 --wait=10 "${url}"; then
echo "== Failed to wget ${url}. Retrying. =="
break
fi
else
echo "== Could not find curl or wget. Retrying. =="
break
fi

if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,20 @@ Resources.AWSAutoScalingLaunchConfigurationmasterustest1bmastersadditionalcidrex

if [[ -e "${file}" ]]; then
echo "== File exists for ${url} =="
elif [[ $(which curl) ]]; then

# CoreOS runs this script in a container without which (but has curl)
# Note also that busybox wget doesn't support wget --version, but busybox doesn't normally have curl
# So we default to wget unless we see curl
elif [[ $(curl --version) ]]; then
if ! curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10 "${url}"; then
echo "== Failed to curl ${url}. Retrying. =="
break
fi
elif [[ $(which wget ) ]]; then
else
if ! wget --inet4-only -O "${file}" --connect-timeout=20 --tries=6 --wait=10 "${url}"; then
echo "== Failed to wget ${url}. Retrying. =="
break
fi
else
echo "== Could not find curl or wget. Retrying. =="
break
fi

if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then
Expand Down Expand Up @@ -327,19 +328,20 @@ Resources.AWSAutoScalingLaunchConfigurationnodesadditionalcidrexamplecom.Propert

if [[ -e "${file}" ]]; then
echo "== File exists for ${url} =="
elif [[ $(which curl) ]]; then

# CoreOS runs this script in a container without which (but has curl)
# Note also that busybox wget doesn't support wget --version, but busybox doesn't normally have curl
# So we default to wget unless we see curl
elif [[ $(curl --version) ]]; then
if ! curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10 "${url}"; then
echo "== Failed to curl ${url}. Retrying. =="
break
fi
elif [[ $(which wget ) ]]; then
else
if ! wget --inet4-only -O "${file}" --connect-timeout=20 --tries=6 --wait=10 "${url}"; then
echo "== Failed to wget ${url}. Retrying. =="
break
fi
else
echo "== Could not find curl or wget. Retrying. =="
break
fi

if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,20 @@ Resources.AWSAutoScalingLaunchConfigurationmasterustest1amastersadditionaluserda

if [[ -e "${file}" ]]; then
echo "== File exists for ${url} =="
elif [[ $(which curl) ]]; then

# CoreOS runs this script in a container without which (but has curl)
# Note also that busybox wget doesn't support wget --version, but busybox doesn't normally have curl
# So we default to wget unless we see curl
elif [[ $(curl --version) ]]; then
if ! curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10 "${url}"; then
echo "== Failed to curl ${url}. Retrying. =="
break
fi
elif [[ $(which wget ) ]]; then
else
if ! wget --inet4-only -O "${file}" --connect-timeout=20 --tries=6 --wait=10 "${url}"; then
echo "== Failed to wget ${url}. Retrying. =="
break
fi
else
echo "== Could not find curl or wget. Retrying. =="
break
fi

if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then
Expand Down Expand Up @@ -357,19 +358,20 @@ Resources.AWSAutoScalingLaunchConfigurationnodesadditionaluserdataexamplecom.Pro

if [[ -e "${file}" ]]; then
echo "== File exists for ${url} =="
elif [[ $(which curl) ]]; then

# CoreOS runs this script in a container without which (but has curl)
# Note also that busybox wget doesn't support wget --version, but busybox doesn't normally have curl
# So we default to wget unless we see curl
elif [[ $(curl --version) ]]; then
if ! curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10 "${url}"; then
echo "== Failed to curl ${url}. Retrying. =="
break
fi
elif [[ $(which wget ) ]]; then
else
if ! wget --inet4-only -O "${file}" --connect-timeout=20 --tries=6 --wait=10 "${url}"; then
echo "== Failed to wget ${url}. Retrying. =="
break
fi
else
echo "== Could not find curl or wget. Retrying. =="
break
fi

if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,20 @@ Resources.AWSAutoScalingLaunchConfigurationmasterustest1amastersminimalexampleco

if [[ -e "${file}" ]]; then
echo "== File exists for ${url} =="
elif [[ $(which curl) ]]; then

# CoreOS runs this script in a container without which (but has curl)
# Note also that busybox wget doesn't support wget --version, but busybox doesn't normally have curl
# So we default to wget unless we see curl
elif [[ $(curl --version) ]]; then
if ! curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10 "${url}"; then
echo "== Failed to curl ${url}. Retrying. =="
break
fi
elif [[ $(which wget ) ]]; then
else
if ! wget --inet4-only -O "${file}" --connect-timeout=20 --tries=6 --wait=10 "${url}"; then
echo "== Failed to wget ${url}. Retrying. =="
break
fi
else
echo "== Could not find curl or wget. Retrying. =="
break
fi

if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then
Expand Down Expand Up @@ -327,19 +328,20 @@ Resources.AWSAutoScalingLaunchConfigurationnodesminimalexamplecom.Properties.Use

if [[ -e "${file}" ]]; then
echo "== File exists for ${url} =="
elif [[ $(which curl) ]]; then

# CoreOS runs this script in a container without which (but has curl)
# Note also that busybox wget doesn't support wget --version, but busybox doesn't normally have curl
# So we default to wget unless we see curl
elif [[ $(curl --version) ]]; then
if ! curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10 "${url}"; then
echo "== Failed to curl ${url}. Retrying. =="
break
fi
elif [[ $(which wget ) ]]; then
else
if ! wget --inet4-only -O "${file}" --connect-timeout=20 --tries=6 --wait=10 "${url}"; then
echo "== Failed to wget ${url}. Retrying. =="
break
fi
else
echo "== Could not find curl or wget. Retrying. =="
break
fi

if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,20 @@ Resources.AWSAutoScalingLaunchConfigurationmasterustest1amastersexternallbexampl

if [[ -e "${file}" ]]; then
echo "== File exists for ${url} =="
elif [[ $(which curl) ]]; then

# CoreOS runs this script in a container without which (but has curl)
# Note also that busybox wget doesn't support wget --version, but busybox doesn't normally have curl
# So we default to wget unless we see curl
elif [[ $(curl --version) ]]; then
if ! curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10 "${url}"; then
echo "== Failed to curl ${url}. Retrying. =="
break
fi
elif [[ $(which wget ) ]]; then
else
if ! wget --inet4-only -O "${file}" --connect-timeout=20 --tries=6 --wait=10 "${url}"; then
echo "== Failed to wget ${url}. Retrying. =="
break
fi
else
echo "== Could not find curl or wget. Retrying. =="
break
fi

if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then
Expand Down Expand Up @@ -347,19 +348,20 @@ Resources.AWSAutoScalingLaunchConfigurationnodesexternallbexamplecom.Properties.

if [[ -e "${file}" ]]; then
echo "== File exists for ${url} =="
elif [[ $(which curl) ]]; then

# CoreOS runs this script in a container without which (but has curl)
# Note also that busybox wget doesn't support wget --version, but busybox doesn't normally have curl
# So we default to wget unless we see curl
elif [[ $(curl --version) ]]; then
if ! curl -f --ipv4 -Lo "${file}" --connect-timeout 20 --retry 6 --retry-delay 10 "${url}"; then
echo "== Failed to curl ${url}. Retrying. =="
break
fi
elif [[ $(which wget ) ]]; then
else
if ! wget --inet4-only -O "${file}" --connect-timeout=20 --tries=6 --wait=10 "${url}"; then
echo "== Failed to wget ${url}. Retrying. =="
break
fi
else
echo "== Could not find curl or wget. Retrying. =="
break
fi

if [[ -n "${hash}" ]] && ! validate-hash "${file}" "${hash}"; then
Expand Down
Loading