[TRAIN-Only] Add healthcheck debug flag
This is a partial cherry-pick of d03401438c
due the other changes in that commit included more complex changes
which needed further patches to address issues.
This change adds a HEALTHCHECK_DEBUG environment variable to the
common health check script to allow a user to enable debug verbosity
when executing a health check. By default this will be off which should
reduce the amount of logging generated by the container healthchecks.
In order to get verbose mode when running the healthcheck directly, you
can do as follow:
podman exec -u root -ti <container> bash
HEALTHCHECK_DEBUG=1 ./openstack/healthcheck
or
podman -u root -e "HEALTHCHECK_DEBUG=1" <container> /openstack/healthcheck
and enjoy a nice debug output.
Closes-Bug: #1893972
Change-Id: Ia15bca89261fecc857afef13680b05aba77fc8de
This commit is contained in:
parent
9b994a2e2d
commit
0e83acbbde
|
@ -1,5 +1,12 @@
|
|||
#!/bin/bash
|
||||
set -euxo pipefail
|
||||
set -euo pipefail
|
||||
: ${HEALTHCHECK_DEBUG:=0}
|
||||
if [ $HEALTHCHECK_DEBUG -ne 0 ]; then
|
||||
set -x
|
||||
exec 3>&1
|
||||
else
|
||||
exec 3>/dev/null
|
||||
fi
|
||||
: ${HEALTHCHECK_CURL_MAX_TIME:=10}
|
||||
: ${HEALTHCHECK_CURL_USER_AGENT:=curl-healthcheck}
|
||||
: ${HEALTHCHECK_CURL_WRITE_OUT:='\n%{http_code} %{remote_ip}:%{remote_port} %{time_total} seconds\n'}
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
features:
|
||||
- |
|
||||
Introduce new HEALTHCHECK_DEBUG variable in order to toggle verbosity,
|
||||
defaults to 0 (no verbosity). Setting it to 1 will activate -x flag,
|
||||
among other things.
|
Loading…
Reference in New Issue