fix: resolve 10 bugs across scripts
- manage_runner.sh: fix RUNNER_DEFAULT_IMAGE clobbering by renaming per-runner var to RUNNER_SECTION_IMAGE; .env fallback now works - manage_runner.sh: render native runner config.yaml before registration so act_runner can read it during --config flag - manage_runner.sh: add SSH credential validation for remote hosts (fail early with clear error instead of cryptic SSH failure) - phase1/phase2: add UNRAID_DB_IP/FEDORA_DB_IP to conditional require_vars when DB_TYPE != sqlite3 - cleanup.sh: only clear manifest when all actions for host succeeded; failed actions are preserved for retry - phase8_cutover.sh: strip empty environment: block from Caddy docker-compose when TLS_MODE=existing - phase5_migrate_pipelines.sh, phase5_teardown.sh, phase9_teardown.sh: wrap cd+git in subshells so working directory is always restored - phase3_post_check.sh: handle both string and numeric runner status from Gitea API (offline vs 2) - configure_env.sh: fix TOTAL_PROMPTS base count (63->64) and move DB/repo count adjustments before their prompts are shown Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -214,6 +214,7 @@ for host in "${HOSTS[@]}"; do
|
||||
log_info "=== Cleaning up: ${host} ==="
|
||||
|
||||
ssh_key=$(host_to_ssh_key "$host")
|
||||
HOST_FAILED=0
|
||||
|
||||
# Read entries into array, then reverse (bash 3.2 compatible — no mapfile)
|
||||
entries=()
|
||||
@@ -237,99 +238,102 @@ for host in "${HOSTS[@]}"; do
|
||||
if cleanup_brew_pkg "$target"; then
|
||||
CLEANED=$((CLEANED + 1))
|
||||
else
|
||||
FAILED=$((FAILED + 1))
|
||||
FAILED=$((FAILED + 1)); HOST_FAILED=$((HOST_FAILED + 1))
|
||||
fi
|
||||
;;
|
||||
dnf_pkg)
|
||||
if [[ -z "$ssh_key" ]]; then
|
||||
log_warn "Cannot clean up dnf_pkg '$target' — no SSH key for host '$host'"
|
||||
FAILED=$((FAILED + 1))
|
||||
FAILED=$((FAILED + 1)); HOST_FAILED=$((HOST_FAILED + 1))
|
||||
continue
|
||||
fi
|
||||
if cleanup_dnf_pkg "$ssh_key" "$target"; then
|
||||
CLEANED=$((CLEANED + 1))
|
||||
else
|
||||
FAILED=$((FAILED + 1))
|
||||
FAILED=$((FAILED + 1)); HOST_FAILED=$((HOST_FAILED + 1))
|
||||
fi
|
||||
;;
|
||||
static_bin)
|
||||
if [[ -z "$ssh_key" ]]; then
|
||||
log_warn "Cannot clean up static_bin '$target' — no SSH key for host '$host'"
|
||||
FAILED=$((FAILED + 1))
|
||||
FAILED=$((FAILED + 1)); HOST_FAILED=$((HOST_FAILED + 1))
|
||||
continue
|
||||
fi
|
||||
if cleanup_static_bin "$ssh_key" "$target"; then
|
||||
CLEANED=$((CLEANED + 1))
|
||||
else
|
||||
FAILED=$((FAILED + 1))
|
||||
FAILED=$((FAILED + 1)); HOST_FAILED=$((HOST_FAILED + 1))
|
||||
fi
|
||||
;;
|
||||
docker_group)
|
||||
if [[ -z "$ssh_key" ]]; then
|
||||
log_warn "Cannot clean up docker_group '$target' — no SSH key for host '$host'"
|
||||
FAILED=$((FAILED + 1))
|
||||
FAILED=$((FAILED + 1)); HOST_FAILED=$((HOST_FAILED + 1))
|
||||
continue
|
||||
fi
|
||||
if cleanup_docker_group "$ssh_key" "$target"; then
|
||||
CLEANED=$((CLEANED + 1))
|
||||
else
|
||||
FAILED=$((FAILED + 1))
|
||||
FAILED=$((FAILED + 1)); HOST_FAILED=$((HOST_FAILED + 1))
|
||||
fi
|
||||
;;
|
||||
systemd_svc)
|
||||
if [[ -z "$ssh_key" ]]; then
|
||||
log_warn "Cannot clean up systemd_svc '$target' — no SSH key for host '$host'"
|
||||
FAILED=$((FAILED + 1))
|
||||
FAILED=$((FAILED + 1)); HOST_FAILED=$((HOST_FAILED + 1))
|
||||
continue
|
||||
fi
|
||||
if cleanup_systemd_svc "$ssh_key" "$target"; then
|
||||
CLEANED=$((CLEANED + 1))
|
||||
else
|
||||
FAILED=$((FAILED + 1))
|
||||
FAILED=$((FAILED + 1)); HOST_FAILED=$((HOST_FAILED + 1))
|
||||
fi
|
||||
;;
|
||||
xcode_cli)
|
||||
if cleanup_xcode_cli; then
|
||||
CLEANED=$((CLEANED + 1))
|
||||
else
|
||||
FAILED=$((FAILED + 1))
|
||||
FAILED=$((FAILED + 1)); HOST_FAILED=$((HOST_FAILED + 1))
|
||||
fi
|
||||
;;
|
||||
ssh_key)
|
||||
if [[ -z "$ssh_key" ]]; then
|
||||
log_warn "Cannot clean up ssh_key '$target' — no SSH key for host '$host'"
|
||||
FAILED=$((FAILED + 1))
|
||||
FAILED=$((FAILED + 1)); HOST_FAILED=$((HOST_FAILED + 1))
|
||||
continue
|
||||
fi
|
||||
if cleanup_ssh_key "$ssh_key" "$target"; then
|
||||
CLEANED=$((CLEANED + 1))
|
||||
else
|
||||
FAILED=$((FAILED + 1))
|
||||
FAILED=$((FAILED + 1)); HOST_FAILED=$((HOST_FAILED + 1))
|
||||
fi
|
||||
;;
|
||||
authorized_key)
|
||||
if [[ -z "$ssh_key" ]]; then
|
||||
log_warn "Cannot clean up authorized_key '$target' — no SSH key for host '$host'"
|
||||
FAILED=$((FAILED + 1))
|
||||
FAILED=$((FAILED + 1)); HOST_FAILED=$((HOST_FAILED + 1))
|
||||
continue
|
||||
fi
|
||||
if cleanup_authorized_key "$ssh_key" "$target"; then
|
||||
CLEANED=$((CLEANED + 1))
|
||||
else
|
||||
FAILED=$((FAILED + 1))
|
||||
FAILED=$((FAILED + 1)); HOST_FAILED=$((HOST_FAILED + 1))
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
log_warn "Unknown action type '${action_type}' for target '${target}' — skipping"
|
||||
FAILED=$((FAILED + 1))
|
||||
FAILED=$((FAILED + 1)); HOST_FAILED=$((HOST_FAILED + 1))
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Clear the manifest after successful cleanup (unless dry run)
|
||||
if [[ "$DRY_RUN" == "false" ]]; then
|
||||
# Only clear the manifest if all actions for this host succeeded.
|
||||
# Failed actions remain in the manifest so they can be retried.
|
||||
if [[ "$DRY_RUN" == "false" ]] && [[ "$HOST_FAILED" -eq 0 ]]; then
|
||||
manifest_clear "$host"
|
||||
log_success "Manifest cleared for ${host}"
|
||||
elif [[ "$DRY_RUN" == "false" ]] && [[ "$HOST_FAILED" -gt 0 ]]; then
|
||||
log_warn "Manifest preserved for ${host} — ${HOST_FAILED} action(s) failed"
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
Reference in New Issue
Block a user