'local result=$(cmd)' resets $? to 0 (the local builtin's own exit), so the
following checkSuccess always saw success regardless of cmd's real exit — the
mechanism that masked the de-sudo write failures. Split declaration from
assignment ('local result; result=$(cmd)') across all 235 active-code sites
(84 files) so the command's exit reaches checkSuccess. No behaviour change
beyond $? now being accurate (no set -e in runtime code; multi-line
assignments transform safely).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: librelad <librelad@digitalangels.vip>
25 lines
966 B
Bash
Executable File
25 lines
966 B
Bash
Executable File
#!/bin/bash
|
|
|
|
dockerPruneAppNetworks()
|
|
{
|
|
if [[ $CFG_REQUIREMENT_DOCKER_NETWORK_PRUNE == "true" ]]; then
|
|
local app_name="$1"
|
|
if [ ! -z "$app_name" ]; then
|
|
local networks_found=false
|
|
# Prune all networks except those containing the specified app_name
|
|
for network_id in $(runFileOp docker network ls --quiet); do
|
|
network_name=$(runFileOp docker network inspect --format '{{.Name}}' "$network_id")
|
|
if [[ "$network_name" == *"$app_name"* ]]; then
|
|
local result; result=$(dockerCommandRun "docker network rm "$network_id"")
|
|
checkSuccess "Removing the unused runFileOp docker network - $network_name"
|
|
networks_found=true
|
|
fi
|
|
done
|
|
|
|
if [ "$networks_found" = false ]; then
|
|
isSuccessful "No unused networks found for $app_name"
|
|
fi
|
|
fi
|
|
fi
|
|
}
|