From 5aedd7e3ed42dc003df443ebc505c0b9c36a41f7 Mon Sep 17 00:00:00 2001 From: Abhishek Pandey Date: Fri, 21 Jul 2023 00:41:00 -0700 Subject: [PATCH] persist failed backups --- src/internal/operations/backup.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/internal/operations/backup.go b/src/internal/operations/backup.go index b684ff591..a87aefcb7 100644 --- a/src/internal/operations/backup.go +++ b/src/internal/operations/backup.go @@ -227,8 +227,7 @@ func (op *BackupOperation) Run(ctx context.Context) (err error) { op.Errors.Fail(clues.Wrap(err, "running backup")) } - isPartialBackup := err != nil && - (deets == nil || deets.Empty()) + isAtleastPartialBackup := deets != nil && !deets.Empty() finalizeErrorHandling(ctx, op.Options, op.Errors, "running backup") LogFaultErrors(ctx, op.Errors.Errors(), "running backup") @@ -237,8 +236,9 @@ func (op *BackupOperation) Run(ctx context.Context) (err error) { // Persistence // ----- + // TODO(pandeyabs): Move createBackupModel before these err = op.persistResults(startTime, &opStats) - if err != nil && !isPartialBackup { + if err != nil && !isAtleastPartialBackup { op.Errors.Fail(clues.Wrap(err, "persisting backup results")) return op.Errors.Failure() } @@ -253,7 +253,7 @@ func (op *BackupOperation) Run(ctx context.Context) (err error) { Infow("completed backup; conditional error forcing exit without model persistence", "results", op.Results) - if !isPartialBackup { + if !isAtleastPartialBackup { return op.Errors.Fail(clues.Wrap(e, "forced backup")).Failure() } }