tripleo-common/healthcheck/opendaylight-api
Janki Chhatbar 14c2361901 Make ODL healthcheck IPv6 compatible
Add missing brackets around IPv6 address
in healthcheck curl URL for ODL.

Change-Id: I165a3a44fad12c36160d201541971cf0a395b38c
Closes-Bug: #1789350
(cherry picked from commit 2ed70a654b)
2018-10-08 04:57:55 +00:00

20 lines
719 B
Bash
Executable File

#!/bin/bash
. ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh
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
# Make Healthcheck URL IPv6 compatible
if [[ $bind_host =~ .*:.* ]]; then
bind_host="[${bind_host}]"
fi
healthcheck_curl http://$bind_host:$bind_port/diagstatus