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
(cherry picked from commit f1a1c324fb)
This commit is contained in:
Jose Luis Franco Arza 2018-07-16 09:40:11 +02:00 committed by Ning Yao
parent fe144d9127
commit 7f9606ff47

View File

@ -50,9 +50,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}
}