From fd8dd15b40619f7ff0e72ba15c2b83719e499650 Mon Sep 17 00:00:00 2001 From: rob Date: Wed, 22 Jul 2026 10:59:49 +0000 Subject: [PATCH] clone-backup: missing *-secrets backup is a benign skip, not a failure Secrets volumes are regenerated at create-node and generally have no backup by design. Counting the skip as Failed (exit 1) false-failed whole provisions whose data volumes transferred fine (tempo de-32->de-27, job e9634e66: executor's broken-pipe guard reset the action and would have re-cloned everything). Reported by claude@ (inbox 829bc624). - no-backup on a *-secrets volume -> return 2 (skip), both nc and ssh paths - rc=2 tracked as Skipped in the summary, excluded from the failure count - exit status now keys on failed_volumes only Co-Authored-By: Claude Fable 5 --- clone-backup.sh | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/clone-backup.sh b/clone-backup.sh index 3dfe222b..b3ef6f21 100755 --- a/clone-backup.sh +++ b/clone-backup.sh @@ -305,6 +305,10 @@ transfer_backup() { backup_file=$(select_newest_local_backup "$backup_dir" "$volume_name") if [[ -z "$backup_file" ]] || [[ ! -f "$backup_file" ]]; then + if [[ "$volume_name" == *-secrets ]]; then + echo "Note: no backup for secrets volume $volume_name (regenerated at create-node), skipping" + return 2 + fi echo "Warning: No restorable backup file found for $volume_name, skipping" return 1 fi @@ -505,6 +509,10 @@ transfer_backup_ssh() { backup_file=$(select_newest_local_backup "$backup_dir" "$volume_name") if [[ -z "$backup_file" ]] || [[ ! -f "$backup_file" ]]; then + if [[ "$volume_name" == *-secrets ]]; then + echo "Note: no backup for secrets volume $volume_name (regenerated at create-node), skipping" + return 2 + fi echo "Warning: No restorable backup file found for $volume_name, skipping" return 1 fi @@ -629,18 +637,26 @@ main() { echo "----------------------------------------" success_count=0 + skipped_volumes="" failed_volumes="" - + for key in $keys; do # Try nc method first transfer_backup "$key" - - if [[ $? -ne 0 ]]; then + rc=$? + + if [[ $rc -eq 2 ]]; then + # secrets volume with no backup — regenerated at create-node, not a failure + skipped_volumes="$skipped_volumes $key" + elif [[ $rc -ne 0 ]]; then echo "NC transfer failed, trying direct SSH..." transfer_backup_ssh "$key" - - if [[ $? -eq 0 ]]; then + rc=$? + + if [[ $rc -eq 0 ]]; then success_count=$((success_count + 1)) + elif [[ $rc -eq 2 ]]; then + skipped_volumes="$skipped_volumes $key" else failed_volumes="$failed_volumes $key" fi @@ -654,6 +670,7 @@ main() { echo "" echo "Transfer Summary:" echo " Successful: $success_count/$volume_count" + [[ -n "$skipped_volumes" ]] && echo " Skipped (no backup by design):$skipped_volumes" [[ -n "$failed_volumes" ]] && echo " Failed:$failed_volumes" # Restore Network buffer and congestion control settings. @@ -683,7 +700,7 @@ main() { $SSH_CMD -O exit "$DEST_HOST" 2>/dev/null # Exit with appropriate status (cleanup will be handled by trap) - [[ $success_count -eq $volume_count ]] && exit 0 || exit 1 + [[ -z "$failed_volumes" ]] && exit 0 || exit 1 } main "$@"