Catch packstack execution failures so we can still recover logs

This also prevents an error to occur if installation failed
before tempest was installed

Change-Id: I525cbc2022a455113c900b10f301a6fac52d59f3
This commit is contained in:
David Moreau Simard 2016-01-27 17:19:12 -05:00
parent 413dac6d63
commit b9fb64af7c
3 changed files with 12 additions and 6 deletions

View File

@ -60,17 +60,23 @@ $SUDO python setup.py install
$SUDO python setup.py install_puppet_modules
# Generate configuration from selected scenario and run it
./tests/${SCENARIO}.sh
source ./tests/${SCENARIO}.sh
result=$?
# Generate subunit
pushd /var/lib/tempest
/var/lib/tempest/.venv/bin/testr last --subunit > /var/tmp/packstack/latest/testrepository.subunit
popd
if [ -d /var/lib/tempest ]; then
pushd /var/lib/tempest
/var/lib/tempest/.venv/bin/testr last --subunit > /var/tmp/packstack/latest/testrepository.subunit || true
popd
fi
if [ "${COPY_LOGS}" = true ]; then
source ./tools/copy-logs.sh
recover_default_logs
fi
if [ "${FAILURE}" = true ]; then
exit 1
fi
exit $result

View File

@ -33,4 +33,4 @@ packstack --allinone \
--gen-answer-file=${PACKSTACK_CONFIG_FILE}
sed -i -re "s,(.*_PASSWORD|.*_PW)=.*,\1=packstack," ${PACKSTACK_CONFIG_FILE}
$SUDO packstack --answer-file=${PACKSTACK_CONFIG_FILE}
$SUDO packstack --answer-file=${PACKSTACK_CONFIG_FILE} || export FAILURE="true"

View File

@ -36,4 +36,4 @@ packstack --allinone \
--gen-answer-file=${PACKSTACK_CONFIG_FILE}
sed -i -re "s,(.*_PASSWORD|.*_PW)=.*,\1=packstack," ${PACKSTACK_CONFIG_FILE}
$SUDO packstack --answer-file=${PACKSTACK_CONFIG_FILE}
$SUDO packstack --answer-file=${PACKSTACK_CONFIG_FILE} || export FAILURE="true"