feat: Add _remove_volume helper to agent-remote common.sh
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user