Omit grep process in nova_api healthcheck.

Currently, the nova_api healthcheck uses the output
from the ps -ef command passing it to grep looking
for the nova_metadata process. However, the way it's
done currently would print out the grep commmand itself
which would cause a false negative.

 ()[root@undercloud-0 /]# ps -ef | grep nova-metadata
 root       10979    8969  0 10:53 ?        00:00:00
 grep --color=auto nova-metadata

This patch uses pgrep intead, which does not create a
grep process that could match the string, plus it
provides a clearer idea on what we are trying to match.

Change-Id: Id493b3d0088e44c831b138b4526681694481d0eb
Closes-Bug: #1801365
This commit is contained in:
Jose Luis Franco Arza 2018-11-02 15:52:59 +01:00
parent 1ee3c59dc7
commit de6f82008d

View File

@ -3,7 +3,7 @@
. ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh
if ps -ef | grep --quiet nova-metadata; then
if pgrep -f nova-metadata; then
check_url=$(get_url_from_vhost /etc/httpd/conf.d/10-nova_metadata_wsgi.conf)
else
check_url=$(get_url_from_vhost /etc/httpd/conf.d/10-nova_api_wsgi.conf)