Partnership echo/log audit pass + exit trap

Exit trap (_pm_trap_restart_stopped) in partnership_manager.sh: restarts locally
stopped containers if script crashes mid-cleanup; partnership_offboard.sh registers
same trap. echo/log audit: step result lines (stack deployed counts, state writes,
onboard/offboard complete) → echo; check mode ACTIVE/INACTIVE status → echo;
ssh_setup.sh key-exists and install/verify results → echo. Manual-Partnership.md:
added Output Tiers section.
This commit is contained in:
Gmer4Lfe
2026-05-21 17:11:05 -04:00
parent 588cde1cc4
commit 86b31256ed
5 changed files with 60 additions and 15 deletions
+5 -2
View File
@@ -124,6 +124,8 @@ OFFLINE_COUNTER="/boot/config/partnership_offline_days.db"
acquire_lock "strict"
trap _pm_trap_restart_stopped EXIT
# Check already offboarded
if [[ -f "$LOCAL_STATE_FILE" ]]; then
CURRENT_STATE=$(read_state_file "$LOCAL_STATE_FILE" "state")
@@ -265,6 +267,7 @@ cleanup_deployed_stack_locally() {
--format '{{range .HostConfig.Binds}}{{println .}}{{end}}' \
"$cname" 2>/dev/null | awk -F: '{print $1}' | grep '^/mnt/.*/appdata')
timeout "${DOCKER_TIMEOUT:-30}" docker stop "$cname" >/dev/null 2>&1 || true
_PM_TRAP_STOPPED+=("$cname")
timeout "${DOCKER_TIMEOUT:-30}" docker rm "$cname" >/dev/null 2>&1 && \
log " $cname removed ✅" || warn " $cname rm failed"
else
@@ -428,7 +431,7 @@ if [[ "$AM_MIRROR" == true ]]; then
if [[ "$DRY_RUN" == false ]]; then
write_state_file "$LOCAL_STATE_FILE" \
"INACTIVE" "" "$NOW" "$LOCAL_SERVER_NAME" "$REASON"
log "Local state: INACTIVE ✅"
echo "Local state: INACTIVE ✅"
add_to_blocklist "$OWNER" "$REASON"
else
warn "DRY RUN — would write INACTIVE state and blocklist $OWNER"
@@ -626,7 +629,7 @@ fi
if [[ ${#PARTNERSHIP_MIRROR_BACKUPS[@]} -gt 0 ]]; then
echo ""
echo "━━━ $ICON_DISK Backup Handover ━━━"
log "Backups available for $MIRROR:"
echo "Backups available for $MIRROR:"
for path in "${PARTNERSHIP_MIRROR_BACKUPS[@]}"; do
[[ -z "$path" ]] && continue
echo " $path"