Fix devstack plugin for /var/log/dib-build exists

The recent change to log the DIB output assumes the /var/log/dib-build
directory does not exist. This is not the case on dev systems.
This patch now handles the case where an old /var/log/dib-build exists.

Change-Id: If4116e2c9b13db64b07ffbc3fd6af13e2373b860
This commit is contained in:
Michael Johnson 2018-11-13 13:07:46 -08:00 committed by Carlos Goncalves
parent 1b71a56791
commit c62031f909
1 changed files with 5 additions and 1 deletions

View File

@ -79,9 +79,13 @@ function build_octavia_worker_image {
if [[ ${OCTAVIA_AMP_IMAGE_SIZE:+1} ]] ; then
export PARAM_OCTAVIA_AMP_IMAGE_SIZE='-s '$OCTAVIA_AMP_IMAGE_SIZE
fi
if ! [ -f $OCTAVIA_AMP_IMAGE_FILE ]; then
local dib_logs=/var/log/dib-build
sudo mkdir ${dib_logs}
if [[ -e ${dib_logs} ]]; then
sudo rm -rf ${dib_logs}
fi
sudo mkdir -m755 ${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:-}
fi