From f32671359edc7f87c9f77e58d81e0b4d88bffdbe Mon Sep 17 00:00:00 2001 From: melanie witt Date: Wed, 21 Aug 2019 19:15:59 +0000 Subject: [PATCH] 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 --- gate/post_test_hook.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gate/post_test_hook.sh b/gate/post_test_hook.sh index fd439b8eb5..b338573ec9 100755 --- a/gate/post_test_hook.sh +++ b/gate/post_test_hook.sh @@ -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