persist failed backups

This commit is contained in:
Abhishek Pandey 2023-07-21 00:41:00 -07:00
parent 52f462abf9
commit 5aedd7e3ed

View File

@ -227,8 +227,7 @@ func (op *BackupOperation) Run(ctx context.Context) (err error) {
op.Errors.Fail(clues.Wrap(err, "running backup")) op.Errors.Fail(clues.Wrap(err, "running backup"))
} }
isPartialBackup := err != nil && isAtleastPartialBackup := deets != nil && !deets.Empty()
(deets == nil || deets.Empty())
finalizeErrorHandling(ctx, op.Options, op.Errors, "running backup") finalizeErrorHandling(ctx, op.Options, op.Errors, "running backup")
LogFaultErrors(ctx, op.Errors.Errors(), "running backup") LogFaultErrors(ctx, op.Errors.Errors(), "running backup")
@ -237,8 +236,9 @@ func (op *BackupOperation) Run(ctx context.Context) (err error) {
// Persistence // Persistence
// ----- // -----
// TODO(pandeyabs): Move createBackupModel before these
err = op.persistResults(startTime, &opStats) err = op.persistResults(startTime, &opStats)
if err != nil && !isPartialBackup { if err != nil && !isAtleastPartialBackup {
op.Errors.Fail(clues.Wrap(err, "persisting backup results")) op.Errors.Fail(clues.Wrap(err, "persisting backup results"))
return op.Errors.Failure() 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", Infow("completed backup; conditional error forcing exit without model persistence",
"results", op.Results) "results", op.Results)
if !isPartialBackup { if !isAtleastPartialBackup {
return op.Errors.Fail(clues.Wrap(e, "forced backup")).Failure() return op.Errors.Fail(clues.Wrap(e, "forced backup")).Failure()
} }
} }