Merge "Cleanup the build directories earlier"
This commit is contained in:
commit
cdf4467a8a
@ -274,7 +274,10 @@ for X in ${!IMAGE_TYPES[@]} ; do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Unmount and cleanup the /mnt and /build subdirectories, to save
|
||||||
|
# space before converting the image to some other format.
|
||||||
unmount_image
|
unmount_image
|
||||||
|
cleanup_build_dir
|
||||||
|
|
||||||
has_raw_type=
|
has_raw_type=
|
||||||
if [ "$IS_RAMDISK" == "0" ]; then
|
if [ "$IS_RAMDISK" == "0" ]; then
|
||||||
@ -292,9 +295,8 @@ if [ -n "$has_raw_type" ]; then
|
|||||||
compress_and_save_image $IMAGE_NAME.$IMAGE_TYPE
|
compress_and_save_image $IMAGE_NAME.$IMAGE_TYPE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Always cleanup after ourselves
|
# Remove the leftovers, i.e. the temporary image directory.
|
||||||
rm -f $TMP_IMAGE_PATH
|
cleanup_image_dir
|
||||||
cleanup_dirs
|
|
||||||
|
|
||||||
case "$IMAGE_ELEMENT" in
|
case "$IMAGE_ELEMENT" in
|
||||||
*ironic-agent*)
|
*ironic-agent*)
|
||||||
|
@ -172,13 +172,20 @@ function mount_qcow_image() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function cleanup_dirs () {
|
function cleanup_build_dir () {
|
||||||
sudo rm -rf $TMP_BUILD_DIR/built
|
sudo rm -rf $TMP_BUILD_DIR/built
|
||||||
sudo rm -rf $TMP_BUILD_DIR/mnt
|
sudo rm -rf $TMP_BUILD_DIR/mnt
|
||||||
if tmpfs_check 0; then
|
if tmpfs_check 0; then
|
||||||
sudo umount -f $TMP_BUILD_DIR $TMP_IMAGE_DIR || true
|
sudo umount -f $TMP_BUILD_DIR || true
|
||||||
fi
|
fi
|
||||||
rm -rf --one-file-system $TMP_BUILD_DIR $TMP_IMAGE_DIR
|
rm -rf --one-file-system $TMP_BUILD_DIR
|
||||||
|
}
|
||||||
|
|
||||||
|
function cleanup_image_dir () {
|
||||||
|
if tmpfs_check 0; then
|
||||||
|
sudo umount -f $TMP_IMAGE_DIR || true
|
||||||
|
fi
|
||||||
|
rm -rf --one-file-system $TMP_IMAGE_DIR
|
||||||
}
|
}
|
||||||
|
|
||||||
# Run a directory of hooks outside the target (that is, no chrooting).
|
# Run a directory of hooks outside the target (that is, no chrooting).
|
||||||
|
@ -36,7 +36,8 @@ function trap_cleanup() {
|
|||||||
|
|
||||||
function cleanup () {
|
function cleanup () {
|
||||||
unmount_image
|
unmount_image
|
||||||
cleanup_dirs
|
cleanup_build_dir
|
||||||
|
cleanup_image_dir
|
||||||
}
|
}
|
||||||
|
|
||||||
function ensure_nbd () {
|
function ensure_nbd () {
|
||||||
|
Loading…
Reference in New Issue
Block a user