Take WSGIScriptAlias into account in docker healthcheck.

Some services running as vhost, as nova_placement make
use of an  alias in which the wsgi service is mapped.
Currently, the nova_placement healthcheck has hardcoded
the alias in the curl [0] request, but if this alias
changes or other service modifies its from / to another,
then the check will start failing again.

[0] - https://github.com/openstack/tripleo-common/blob/master/healthcheck/nova-placement#L6

Change-Id: I5a325be424740e80eafd6b4abd8eb4b3111740aa
Closes-Bug: #1781623
This commit is contained in:
Jose Luis Franco Arza 2018-07-16 09:40:11 +02:00
parent 0d28cf7092
commit f1a1c324fb
2 changed files with 6 additions and 2 deletions

View File

@ -63,9 +63,13 @@ get_url_from_vhost () {
server_name=$(awk '/ServerName/ {print $2}' $vhost_file)
ssl_enabled=$(awk '/SSLEngine/ {print $2}' $vhost_file)
bind_port=$(grep -h "<VirtualHost .*>" $vhost_file | sed 's/<VirtualHost .*:\(.*\)>/\1/')
wsgi_alias=$(awk '/WSGIScriptAlias/ {print $2}' $vhost_file)
proto=http
if [[ $ssl_enabled == "on" ]]; then
proto=https
fi
echo ${proto}://${server_name}:${bind_port}/
if [[ $wsgi_alias != "/" ]]; then
wsgi_alias="${wsgi_alias}/"
fi
echo ${proto}://${server_name}:${bind_port}${wsgi_alias}
}

View File

@ -3,4 +3,4 @@
. ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh
check_url=$(get_url_from_vhost /etc/httpd/conf.d/10-placement_wsgi.conf)
healthcheck_curl ${check_url}/placement/
healthcheck_curl ${check_url}