Make a failure to purge_db fail in post_test_hook.sh

Currently, the 'purge_db' call occurs before 'set -e', so if and when
the database purge fails (return non-zero) it does not cause the script
to exit with a failure.

This moves the call after 'set -e' to make the script exit with a
failure if the database purge step fails.

Closes-Bug: #1840967

Change-Id: I6ae27c4e11acafdc0bba8813f47059d084758b4e
This commit is contained in:
melanie witt
2019-08-21 19:15:59 +00:00
parent 6ddfad5935
commit f32671359e

View File

@@ -43,10 +43,17 @@ cell_conf=$(conductor_conf 1)
# take precedence.
conf="--config-file $NOVA_CONF --config-file $cell_conf"
# This needs to go before 'set -e' because otherwise the intermediate runs of
# 'nova-manage db archive_deleted_rows' returning 1 (normal and expected) would
# cause this script to exit and fail.
archive_deleted_rows $conf
purge_db
set -e
# This needs to go after 'set -e' because otherwise a failure to purge the
# database would not cause this script to exit and fail.
purge_db
# We need to get the admin credentials to run the OSC CLIs for Placement.
set +x
source $BASE/devstack/openrc admin