Revert "Explicitly trap on ERR" and fix exit code hanlding

Trapping on ERR does not do what is implied here and is redundant when
trapping on EXIT is used together with `set -e`. The real problem is
that in the CI scripts we pipe test-bifrost.sh into tee with a log file
without setting -o pipefail in bash. This change fixes it.

This reverts commit b31bc66726.

Change-Id: Ifca4049f5967c0b2153ecffb4c153a96b4a62cc7
This commit is contained in:
Dmitry Tantsur 2021-11-16 10:09:13 +00:00
parent 69cbcf4348
commit 3dbc7347ec
3 changed files with 6 additions and 3 deletions

View File

@ -1,8 +1,11 @@
- hosts: all
tasks:
- shell:
cmd: bash scripts/test-bifrost.sh 2>&1 | tee "{{ ansible_user_dir }}/bifrost.log"
cmd: |
set -eo pipefail
./scripts/test-bifrost.sh 2>&1 | tee "{{ ansible_user_dir }}/bifrost.log"
chdir: "{{ ansible_user_dir }}/{{ zuul.projects['opendev.org/openstack/bifrost'].src_dir }}"
executable: /bin/bash
environment:
BIFROST_TRACE: "true"
BUILD_IMAGE: "{{ build_image | default(false) | bool | lower }}"

View File

@ -83,7 +83,8 @@ sudo journalctl -u uwsgi@keystone-admin &> ${LOG_LOCATION}/keystone-admin.log
# Copy PXE information
mkdir -p ${LOG_LOCATION}/pxe/
cp /httpboot/ipxe.* ${LOG_LOCATION}/pxe/
ls -lR /httpboot > ${LOG_LOCATION}/pxe/listing.txt
cp -aL /httpboot/*.ipxe ${LOG_LOCATION}/pxe/
cp -aL /httpboot/pxelinux.cfg/ ${LOG_LOCATION}/pxe/
# Copy baremetal information

View File

@ -139,7 +139,6 @@ on_exit() {
$SCRIPT_HOME/collect-test-info.sh
}
trap on_exit EXIT
trap on_exit ERR
# Change working directory
cd $BIFROST_HOME/playbooks