Merge "Add timeout to the wait_for method in plugin.sh"

This commit is contained in:
Zuul 2018-02-21 10:50:16 +00:00 committed by Gerrit Code Review
commit 450cc1d91f
2 changed files with 6 additions and 0 deletions

View File

@ -413,6 +413,7 @@ function wait_for {
local url
local cacert_path
local flags
local timeout=$KURYR_WAIT_TIMEOUT
name="$1"
url="$2"
cacert_path=${3:-}
@ -425,8 +426,12 @@ function wait_for {
extra_flags=""
fi
local start_time=$(date +%s)
until curl -o /dev/null -sIf $extra_flags "$url"; do
echo -n "."
local curr_time=$(date +%s)
local time_diff=$(($curr_time - $start_time))
[[ $time_diff -le $timeout ]] || die "Timed out waiting for $name"
sleep 1
done
echo ""

View File

@ -6,6 +6,7 @@ KURYR_CONFIG_DIR=${KURYR_CONFIG_DIR:-/etc/kuryr}
KURYR_CONFIG=${KURYR_CONFIG:-${KURYR_CONFIG_DIR}/kuryr.conf}
KURYR_AUTH_CACHE_DIR=${KURYR_AUTH_CACHE_DIR:-/var/cache/kuryr}
KURYR_LOCK_DIR=${KURYR_LOCK_DIR:-${DATA_DIR}/kuryr-kubernetes}
KURYR_WAIT_TIMEOUT=${KURYR_WAIT_TIMEOUT:-300}
KURYR_DOCKER_ENGINE_SOCKET_FILE=${KURYR_DOCKER_ENGINE_SOCKET_FILE:-/var/run/docker.sock}