Fix dead-variable and exit-code bugs found in codebase-wide audit
Same audit as the orchestrator standardization pass (2a062e5), extended to
every remaining script. Found the same class of bug independently recurring:
ramdisk_stop.sh checked $LOG (nothing assigns it, should be $ENABLE_LOGGING),
partnership_onboard.sh checked $LOG_MODE (same issue), emby_session_report.sh
checked $TRANSCODE_PCT which was never computed so the high-transcode alert
could never fire, and storage_migrate.sh never called detect_hosts() so
$MY_ID was empty, silently breaking the post-migration host*.conf update.
partnership_manager.sh used `local` at top-level script scope (invalid outside
a function) and had two master.conf path references missing "Configurations/".
Along the way: several scripts (share_setup.sh, conf_sync.sh,
downloaders_reset.sh, transcode_cleanup.sh, transcode_manager.sh,
remote_arr_cache_writer.sh, upgrade_webhook_handler.sh) had no explicit
trailing exit code, so they always reported success regardless of real
failures. play_state_sync.sh was missing the partnership gate its own header
documented, so remote play-state sync ran even with PARTNERSHIP_ENABLED=false;
it also always exited 0 on sync errors. arr_profile_enforcer.sh and
webhook_setup.sh hand-rolled their own flag parsing instead of common.sh's
parse_args, so --log silently did nothing on either.
system_watchdog.sh was itself an un-standardized mini-orchestrator — converted
to the shared run_orch_child()/JOB_PASS/JOB_FAIL pattern, added the missing
failure notification, and fixed dry-run to pass --dry-run down to children
instead of skipping them outright. Also fixed a stale webgui_watchdog.sh path
in master.conf.template that would break system_watchdog.sh on any fresh
install.
Closed a sibling-drift gap: radarr_cleanup.sh and sonarr_cleanup.sh were
missing lidarr_cleanup.sh's tracked-count percentage-drop safety gate and its
"not configured on this host, skip cleanly" guard — both now match Lidarr's
7-gate model.
This commit is contained in:
@@ -51,15 +51,16 @@
|
||||
# arr_profile_enforcer.sh --radarr-only
|
||||
# Run only Radarr enforcement.
|
||||
#
|
||||
# arr_profile_enforcer.sh --log
|
||||
# Verbose output.
|
||||
#
|
||||
# ==============================================================================================
|
||||
|
||||
DRY_RUN=false
|
||||
RUN_SONARR=true
|
||||
RUN_RADARR=true
|
||||
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
--dry-run) DRY_RUN=true ;;
|
||||
--sonarr-only) RUN_RADARR=false ;;
|
||||
--radarr-only) RUN_SONARR=false ;;
|
||||
esac
|
||||
@@ -67,6 +68,7 @@ done
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
source "$SCRIPT_DIR/../load_config.sh"
|
||||
parse_args "$@"
|
||||
detect_hosts
|
||||
|
||||
KIDS_PROFILE_NAME="${ARR_KIDS_PROFILE_NAME:-Kids shows}"
|
||||
|
||||
@@ -247,7 +247,7 @@ if [[ "$FILE_COUNT" -gt 0 ]]; then
|
||||
warn "⚠️ $FILE_COUNT file(s) still on ramdisk — will be lost on unmount"
|
||||
warn "Active transcode sessions should be stopped before unmounting"
|
||||
warn "Proceeding regardless (this is expected for maintenance)"
|
||||
if [[ "$LOG" == true ]]; then
|
||||
if [[ "$ENABLE_LOGGING" == true ]]; then
|
||||
find "$RAMDISK_PATH" -type f 2>/dev/null | while read -r f; do
|
||||
log " $f"
|
||||
done
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
# Secret auto-gen — WEBHOOK_SECRET generated if empty; never left blank
|
||||
# --local-only — used internally for SSH; prevents infinite recursion
|
||||
# --dry-run mode — shows what would be registered without making API calls
|
||||
# acquire_lock — prevents concurrent registration runs
|
||||
#
|
||||
# ==============================================================================================
|
||||
# RUNTIME MODES
|
||||
@@ -54,17 +55,18 @@
|
||||
# webhook_setup.sh --dry-run
|
||||
# Show what would be registered without making any changes.
|
||||
#
|
||||
# webhook_setup.sh --log
|
||||
# Verbose output.
|
||||
#
|
||||
# ==============================================================================================
|
||||
|
||||
set -uo pipefail
|
||||
|
||||
LOCAL_ONLY=false
|
||||
DRY_RUN=false
|
||||
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
--local-only) LOCAL_ONLY=true ;;
|
||||
--dry-run) DRY_RUN=true ;;
|
||||
esac
|
||||
done
|
||||
|
||||
@@ -73,6 +75,8 @@ ECOSYSTEM_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
MASTER_CONF="$ECOSYSTEM_ROOT/Configurations/master.conf"
|
||||
|
||||
source "$ECOSYSTEM_ROOT/load_config.sh"
|
||||
parse_args "$@"
|
||||
acquire_lock
|
||||
detect_hosts
|
||||
|
||||
WEBHOOK_NAME="Varaverk Upgrade"
|
||||
|
||||
Reference in New Issue
Block a user