Skip to content

Commit

Permalink
Destroy release also destroys cached release
Browse files Browse the repository at this point in the history
  • Loading branch information
foudil committed Nov 8, 2024
1 parent 62991b6 commit 925cb89
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
6 changes: 3 additions & 3 deletions docs/chapters/subcommands/destroy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ created. Note: containers must be stopped before destroyed.
Note: containers console logs not destroyed.
/usr/local/bastille/logs/folsom_console.log
Release can be detroyed provided there are no child jails. The `force` option
deletes the release cache directory as well:
Releases can be detroyed which also deletes the related cache directory. Child
jails must be destroyed beforehand.

.. code-block:: shell
ishmael ~ # bastille destroy force 14.0-RELEASE
ishmael ~ # bastille destroy 14.0-RELEASE
Deleting base: 14.0-RELEASE
2 changes: 0 additions & 2 deletions docs/chapters/upgrading.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,3 @@ After upgrading all jails from one release to the next you may find that you now
`bastille list releases` to list all bootstrapped releases.

`bastille destroy X.Y-RELEASE` to fully delete the release.

`bastille destroy force X.Y-RELEASE` to delete the cache directory as well.
14 changes: 5 additions & 9 deletions usr/local/share/bastille/destroy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,8 @@ destroy_rel() {
OPTIONS="-rf"
fi
zfs destroy "${OPTIONS}" "${bastille_zfs_zpool}/${bastille_zfs_prefix}/releases/${TARGET}"
if [ "${FORCE}" = "1" ]; then
if [ -d "${bastille_cachedir}/${TARGET}" ]; then
zfs destroy "${OPTIONS}" "${bastille_zfs_zpool}/${bastille_zfs_prefix}/cache/${TARGET}"
fi
if [ -d "${bastille_cachedir}/${TARGET}" ]; then
zfs destroy "${OPTIONS}" "${bastille_zfs_zpool}/${bastille_zfs_prefix}/cache/${TARGET}"
fi
fi
fi
Expand All @@ -169,11 +167,9 @@ destroy_rel() {
rm -rf "${bastille_rel_base}"
fi

if [ "${FORCE}" = "1" ]; then
## remove cache on force
if [ -d "${bastille_cachedir}/${TARGET}" ]; then
rm -rf "${bastille_cachedir}/${TARGET}"
fi
## remove cache
if [ -d "${bastille_cachedir}/${TARGET}" ]; then
rm -rf "${bastille_cachedir}/${TARGET}"
fi
echo
else
Expand Down

0 comments on commit 925cb89

Please sign in to comment.