Remove all app containers before removing volume

If volume location changes, we re-create the volume. However, volume
can only be removed if all the containers using it are deleted. For
example, the scheduler might be running a container using it.
This commit is contained in:
Girish Ramakrishnan
2019-01-17 23:32:24 -08:00
parent ab35821b59
commit 4a9b0e8db6
4 changed files with 18 additions and 26 deletions

View File

@@ -24,6 +24,8 @@ if [[ "${BOX_ENV}" == "test" ]]; then
[[ "${volume_dir}" != *"./cloudron_test/"* ]] && exit 1
fi
rm -rf "${volume_dir}"/*
# mount points cannot be deleted
# this removes hidden files
find "${volume_dir}" -maxdepth 1 -mindepth 1 -exec rm -rf '{}' \;
# volume could be a mount point that cannot be deleted
rmdir "${volume_dir}" || true