From fc5e688df6439c4cccaeda0dd6ea549522e4ab8f Mon Sep 17 00:00:00 2001 From: Markos Chandras Date: Tue, 14 Feb 2017 09:30:18 +0000 Subject: [PATCH] scripts: Collect logs even if deployment fails. Always exit with success code when collecting various logs. This allows this script to be used to collect partial logs in case a deployment fails since it may help with debugging the root cause of the failure. Change-Id: I4d5a2c71303e9ed466b5fd5dbc63469677f2380f --- scripts/collect-test-info.sh | 2 ++ scripts/test-bifrost.sh | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/collect-test-info.sh b/scripts/collect-test-info.sh index 3039b1d96..e033f2527 100755 --- a/scripts/collect-test-info.sh +++ b/scripts/collect-test-info.sh @@ -45,3 +45,5 @@ sudo chown $USER ${LOG_LOCATION}/ironic-conductor.log # In CI scenarios, we want other users to be able to read the logs. sudo chmod o+r ${LOG_LOCATION}/ironic-api.log sudo chmod o+r ${LOG_LOCATION}/ironic-conductor.log + +exit 0 diff --git a/scripts/test-bifrost.sh b/scripts/test-bifrost.sh index 408d86fe9..b1da20d4f 100755 --- a/scripts/test-bifrost.sh +++ b/scripts/test-bifrost.sh @@ -93,6 +93,11 @@ elif [ ${ENABLE_KEYSTONE} = "true" ]; then CLOUD_CONFIG="-e cloud_name=bifrost" fi +logs_on_exit() { + $SCRIPT_HOME/collect-test-info.sh +} +trap logs_on_exit EXIT + # Change working directory cd $BIFROST_HOME/playbooks @@ -157,6 +162,4 @@ if [ $EXITCODE != 0 ]; then echo "****************************" fi -$SCRIPT_HOME/collect-test-info.sh - exit $EXITCODE