diff --git a/scripts/homelab-backup b/scripts/homelab-backup index 65643a1..ccbbba9 100755 --- a/scripts/homelab-backup +++ b/scripts/homelab-backup @@ -29,6 +29,7 @@ Creates a Pimox-aware, age-encrypted disaster-recovery profile archive. Optional env: HOMELAB_PROFILE_BACKUP_DIR Local encrypted archive directory. HOMELAB_BACKUP_OFFSITE_URI file:///path, /path, or ssh://user@host/path. + HOMELAB_BACKUP_OFFSITE_REQUIRED Set true to fail when the optional offsite push fails. KUBECONFIG_PATH Kubeconfig for app inventory. EOF } @@ -315,7 +316,17 @@ pimox_profile_backup() { chmod 0600 "${encrypted_archive}" validate_archive "${encrypted_archive}" - push_offsite "${encrypted_archive}" + # The local encrypted archive is the source consumed by OCI Object + # Storage. A legacy SSH offsite target may be unavailable (for example, + # an old jump-box), so do not prevent the primary backup/upload workflow + # from completing unless the operator explicitly requires that target. + if ! push_offsite "${encrypted_archive}"; then + if [[ "${HOMELAB_BACKUP_OFFSITE_REQUIRED:-false}" == "true" ]]; then + echo "Offsite backup is required and the push failed." >&2 + exit 1 + fi + log "WARNING: optional offsite push failed; retaining the local encrypted archive." + fi log "Created encrypted Pimox profile backup: ${encrypted_archive}" }