mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-07 04:03:20 +00:00
improve output of kube_get_url
This commit is contained in:
@@ -21,8 +21,8 @@ kube::util::sortable_date() {
|
||||
kube::util::wait_for_url() {
|
||||
local url=$1
|
||||
local prefix=${2:-}
|
||||
local wait=${3:-0.2}
|
||||
local times=${4:-10}
|
||||
local wait=${3:-0.5}
|
||||
local times=${4:-25}
|
||||
|
||||
which curl >/dev/null || {
|
||||
kube::log::usage "curl must be installed"
|
||||
@@ -30,16 +30,15 @@ kube::util::wait_for_url() {
|
||||
}
|
||||
|
||||
local i
|
||||
|
||||
for i in $(seq 1 $times); do
|
||||
local out
|
||||
if out=$(curl -fs $url 2>/dev/null); then
|
||||
kube::log::status ${prefix}${out}
|
||||
kube::log::status "On try ${i}, ${prefix}: ${out}"
|
||||
return 0
|
||||
fi
|
||||
sleep $wait
|
||||
sleep ${wait}
|
||||
done
|
||||
kube::log::error "Timed out waiting for ${url}"
|
||||
kube::log::error "Timed out waiting for ${prefix} to answer at ${url}; tried ${times} waiting ${wait} between each"
|
||||
return 1
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user