67ed5a0488
When the /run_command file is not found on the container using the ironic-pxe image, the health status displays unhealthy even though it's not true. The reason is because grep can't find the file and the error makes the whole healthcheck fail. This patch redirects the error output so the command doesn't fail, but the conditional is properly evaluated. Change-Id: Ia6141f5499f34cd10618378f448598f74aca6273 Closes-Bug: #1803153
17 lines
499 B
Bash
Executable File
17 lines
499 B
Bash
Executable File
#!/bin/bash
|
|
|
|
. ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh
|
|
|
|
if grep "/httpd " /run_command 2>/dev/null ; then
|
|
bind_host=127.0.0.1
|
|
bind_port=$(grep "^Listen " /etc/httpd/conf.d/10-ipxe_vhost.conf | awk '{print $2}')
|
|
protocol=http
|
|
path=
|
|
else
|
|
bind_host=$(ps -ef | grep -oe '--address \([0-9]\+\.\?\)\+' | awk '{print $2}')
|
|
bind_port=69
|
|
protocol=tftp
|
|
path=map-file
|
|
fi
|
|
healthcheck_curl ${protocol}://${bind_host}:${bind_port}/${path}
|