From d0f0233061243f284f05843ebdd504f3052049f6 Mon Sep 17 00:00:00 2001 From: Michael Johnson Date: Fri, 24 Apr 2020 08:50:19 -0700 Subject: [PATCH] Make sure devstack aborts if DIB fails There are cases where DIB can fail to create an image but devstack does not abort. This leads the gate job to run all the way down to starting the tempest test before the job will fail out. This adds a simple check for the image file and will abort early if the image is not present. Change-Id: I7ebf4137feb04827490dffc0dac3d6e4c8888075 --- devstack/plugin.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/devstack/plugin.sh b/devstack/plugin.sh index 165487934b..bafac8c395 100644 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash +saveenv=$- +set -e + # devstack plugin for octavia GET_PIP_CACHE_LOCATION=/opt/stack/cache/files/get-pip.py @@ -110,6 +113,12 @@ function build_octavia_worker_image { sudo chown $STACK_USER ${dib_logs} $OCTAVIA_DIR/diskimage-create/diskimage-create.sh -l ${dib_logs}/$(basename $OCTAVIA_AMP_IMAGE_FILE).log $octavia_dib_tracing_arg -o $OCTAVIA_AMP_IMAGE_FILE ${PARAM_OCTAVIA_AMP_BASE_OS:-} ${PARAM_OCTAVIA_AMP_DISTRIBUTION_RELEASE_ID:-} ${PARAM_OCTAVIA_AMP_IMAGE_SIZE:-} fi + + if ! [ -f $OCTAVIA_AMP_IMAGE_FILE ]; then + echo "Diskimage-builder failed to create the amphora image. Aborting." + exit 1 + fi + upload_image file://${OCTAVIA_AMP_IMAGE_FILE} $TOKEN } @@ -799,3 +808,9 @@ if [[ "$1" == "clean" ]]; then octavia_cleanup fi fi + +if [[ $saveenv =~ e ]]; then + set -e +else + set +e +fi