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 <noreply@anthropic.com>
This commit is contained in:
@@ -305,6 +305,10 @@ transfer_backup() {
|
|||||||
backup_file=$(select_newest_local_backup "$backup_dir" "$volume_name")
|
backup_file=$(select_newest_local_backup "$backup_dir" "$volume_name")
|
||||||
|
|
||||||
if [[ -z "$backup_file" ]] || [[ ! -f "$backup_file" ]]; then
|
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"
|
echo "Warning: No restorable backup file found for $volume_name, skipping"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
@@ -505,6 +509,10 @@ transfer_backup_ssh() {
|
|||||||
backup_file=$(select_newest_local_backup "$backup_dir" "$volume_name")
|
backup_file=$(select_newest_local_backup "$backup_dir" "$volume_name")
|
||||||
|
|
||||||
if [[ -z "$backup_file" ]] || [[ ! -f "$backup_file" ]]; then
|
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"
|
echo "Warning: No restorable backup file found for $volume_name, skipping"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
@@ -629,18 +637,26 @@ main() {
|
|||||||
echo "----------------------------------------"
|
echo "----------------------------------------"
|
||||||
|
|
||||||
success_count=0
|
success_count=0
|
||||||
|
skipped_volumes=""
|
||||||
failed_volumes=""
|
failed_volumes=""
|
||||||
|
|
||||||
for key in $keys; do
|
for key in $keys; do
|
||||||
# Try nc method first
|
# Try nc method first
|
||||||
transfer_backup "$key"
|
transfer_backup "$key"
|
||||||
|
rc=$?
|
||||||
if [[ $? -ne 0 ]]; then
|
|
||||||
|
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..."
|
echo "NC transfer failed, trying direct SSH..."
|
||||||
transfer_backup_ssh "$key"
|
transfer_backup_ssh "$key"
|
||||||
|
rc=$?
|
||||||
if [[ $? -eq 0 ]]; then
|
|
||||||
|
if [[ $rc -eq 0 ]]; then
|
||||||
success_count=$((success_count + 1))
|
success_count=$((success_count + 1))
|
||||||
|
elif [[ $rc -eq 2 ]]; then
|
||||||
|
skipped_volumes="$skipped_volumes $key"
|
||||||
else
|
else
|
||||||
failed_volumes="$failed_volumes $key"
|
failed_volumes="$failed_volumes $key"
|
||||||
fi
|
fi
|
||||||
@@ -654,6 +670,7 @@ main() {
|
|||||||
echo ""
|
echo ""
|
||||||
echo "Transfer Summary:"
|
echo "Transfer Summary:"
|
||||||
echo " Successful: $success_count/$volume_count"
|
echo " Successful: $success_count/$volume_count"
|
||||||
|
[[ -n "$skipped_volumes" ]] && echo " Skipped (no backup by design):$skipped_volumes"
|
||||||
[[ -n "$failed_volumes" ]] && echo " Failed:$failed_volumes"
|
[[ -n "$failed_volumes" ]] && echo " Failed:$failed_volumes"
|
||||||
|
|
||||||
# Restore Network buffer and congestion control settings.
|
# Restore Network buffer and congestion control settings.
|
||||||
@@ -683,7 +700,7 @@ main() {
|
|||||||
$SSH_CMD -O exit "$DEST_HOST" 2>/dev/null
|
$SSH_CMD -O exit "$DEST_HOST" 2>/dev/null
|
||||||
|
|
||||||
# Exit with appropriate status (cleanup will be handled by trap)
|
# 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 "$@"
|
main "$@"
|
||||||
|
|||||||
Reference in New Issue
Block a user