From e4b514ca3a4c8a21d025d55ae00940a5591a301f Mon Sep 17 00:00:00 2001 From: Alexander Todorov Date: Mon, 26 Feb 2024 14:41:08 +0200 Subject: [PATCH] Don't trap the EXIT signal twice killing the worker journal via EXIT signal prevents the cleanup() function from executing! NOTE: this is a problem in other scripts as well and needs to be refactored there too! --- test/cases/openshift_virtualization.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/cases/openshift_virtualization.sh b/test/cases/openshift_virtualization.sh index 85a069106..55d92cbbe 100755 --- a/test/cases/openshift_virtualization.sh +++ b/test/cases/openshift_virtualization.sh @@ -19,6 +19,9 @@ function cleanup() { $OC_CLI delete pvc "$PVC_NAME" sudo rm -rf "$TEMPDIR" + + # Stop watching the worker journal when exiting. + sudo pkill -P "${WORKER_JOURNAL_PID}" } trap cleanup EXIT @@ -96,8 +99,6 @@ sudo composer-cli blueprints depsolve bash WORKER_UNIT=$(sudo systemctl list-units | grep -o -E "osbuild.*worker.*\.service") sudo journalctl -af -n 1 -u "${WORKER_UNIT}" & WORKER_JOURNAL_PID=$! -# Stop watching the worker journal when exiting. -trap 'sudo pkill -P ${WORKER_JOURNAL_PID}' EXIT # Start the compose and upload to OpenShift greenprint "🚀 Starting compose" @@ -126,7 +127,6 @@ get_compose_metadata "$COMPOSE_ID" # Kill the journal monitor immediately and remove the trap sudo pkill -P ${WORKER_JOURNAL_PID} -trap - EXIT # Did the compose finish with success? if [[ $COMPOSE_STATUS != FINISHED ]]; then