Fixes OpenDaylight healthcheck

Due to Jetty XML config changes for OpenDaylight, healtcheck no longer
works.  This patch moves the healtcheck to use the pax web config file,
which should be a more consistent method of finding the values for host
IP/port (INI settings).  Also adds logic to support healthcheck with TLS
based deployments.

Closes-Bug: 1751928

Change-Id: I94f351ee3c71ddefe0b5c2bfdcd784d303ccbb24
Signed-off-by: Tim Rozet <trozet@redhat.com>
This commit is contained in:
Tim Rozet 2018-02-26 17:42:33 -05:00
parent d51ed4962a
commit 737439aab5
3 changed files with 14 additions and 5 deletions

View File

@ -3,7 +3,7 @@
: ${HEALTHCHECK_CURL_WRITE_OUT:='\n%{http_code} %{remote_ip}:%{remote_port} %{time_total} seconds\n'}
healthcheck_curl () {
curl -g -q --fail \
curl -g -k -q --fail \
--max-time "${HEALTHCHECK_CURL_MAX_TIME}" \
--user-agent "${HEALTHCHECK_CURL_USER_AGENT}" \
--write-out "${HEALTHCHECK_CURL_WRITE_OUT}" \

View File

@ -2,8 +2,13 @@
. ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh
file=/opt/opendaylight/etc/jetty.xml
bind_host=$(grep -r '<Set name="host">' $file | awk -F'>' FNR==1'{print $2}')
bind_port=$(grep -r '<Property name="jetty.port" default=' $file | awk FNR==2'{print $3}' | cut -d'"' -f2)
file=/opt/opendaylight/etc/org.ops4j.pax.web.cfg
bind_host=$(awk -F "= *" '/^org.ops4j.pax.web.listening.addresses/ {print $2}' $file)
tls_enabled=$(awk -F "= *" '/^org.osgi.service.http.secure.enabled/ {print $2}' $file)
if [[ -z "$tls_enabled" || "$tls_enabled" != "true" ]]; then
bind_port=$(awk -F "= *" '/^org.osgi.service.http.port\s*=/ {print $2}' $file)
else
bind_port=$(awk -F "= *" '/^org.osgi.service.http.port.secure/ {print $2}' $file)
fi
healthcheck_curl http://$bind_host:$bind_port/index.html
healthcheck_curl http://$bind_host:$bind_port/index.html

View File

@ -0,0 +1,4 @@
---
fixes:
- |
Fixes OpenDaylight healthcheck for TLS and regular deployments.