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
This commit is contained in:
Michael Johnson 2020-04-24 08:50:19 -07:00
parent 07a93de755
commit d0f0233061
1 changed files with 15 additions and 0 deletions

View File

@ -1,5 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
saveenv=$-
set -e
# devstack plugin for octavia # devstack plugin for octavia
GET_PIP_CACHE_LOCATION=/opt/stack/cache/files/get-pip.py 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} 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:-} $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 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 upload_image file://${OCTAVIA_AMP_IMAGE_FILE} $TOKEN
} }
@ -799,3 +808,9 @@ if [[ "$1" == "clean" ]]; then
octavia_cleanup octavia_cleanup
fi fi
fi fi
if [[ $saveenv =~ e ]]; then
set -e
else
set +e
fi