feat: Add _remove_volume helper to agent-remote common.sh
All checks were successful
Build-Test-Publish / build (linux/amd64) (push) Successful in 22s
Build-Test-Publish / build (linux/arm64) (push) Successful in 1m9s

This commit is contained in:
j
2026-03-21 22:28:24 +13:00
parent bf34bbbd8d
commit 208433c436

View File

@@ -22,6 +22,7 @@
# _remove_container <container_name> : Stops (if needed) and removes a container.
# _get_container_logs <container_name> : Prints the logs for a container.
# _check_required_env_vars "VAR1" ... : Checks if listed environment variables are set; calls _die() if any are missing.
# _remove_volume <volume_name> : Removes a Docker volume if it exists.
# _root_remove_tree <path> : Removes a path using a root Docker container (for permissions).
# ----------------------------------------------------------------------------------------------------------
@@ -162,6 +163,14 @@ _check_required_env_vars() {
done
}
# Removes a Docker volume if it exists.
_remove_volume() {
[ -n "${1:-}" ] || { echo "_remove_volume: Volume name is empty" >&2; return 1; }
if docker volume inspect "$1" &>/dev/null; then
docker volume rm "$1"
fi
}
# Removes a path using a root Docker container (for permissions).
_root_remove_tree() {
local to_remove="$1"