Skip to content

Commit

Permalink
Merge pull request #65 from sonroyaalmerol/remove-passthrough-proxy
Browse files Browse the repository at this point in the history
ensure to restore ownership on error paths as well
  • Loading branch information
sonroyaalmerol authored Jan 13, 2025
2 parents aaff0ce + 3d84850 commit 24218dd
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions internal/backend/backup/jobrun.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ func RunBackup(job *store.Job, storeInstance *store.Store) (*store.Task, error)
if err := cmd.Start(); err != nil {
monitorCancel() // Cancel monitoring since backup failed to start

if currOwner != "" {
_ = SetDatastoreOwner(job, storeInstance, currOwner)
}

stderr.Close()
stdout.Close()

Expand All @@ -121,6 +125,10 @@ func RunBackup(job *store.Job, storeInstance *store.Store) (*store.Task, error)
stderr.Close()
stdout.Close()

if currOwner != "" {
_ = SetDatastoreOwner(job, storeInstance, currOwner)
}

_ = cmd.Process.Kill()
return nil, fmt.Errorf("RunBackup: no task created")
}
Expand All @@ -129,6 +137,9 @@ func RunBackup(job *store.Job, storeInstance *store.Store) (*store.Task, error)
if err := updateJobStatus(job, task, storeInstance); err != nil {
stderr.Close()
stdout.Close()
if currOwner != "" {
_ = SetDatastoreOwner(job, storeInstance, currOwner)
}

return task, fmt.Errorf("RunBackup: failed to update job status: %w", err)
}
Expand Down

0 comments on commit 24218dd

Please sign in to comment.