fix: use provisionerd context when failing job on canceled acquire (#11118)

Spotted during code read. We need to use the provisionerd auth context when failing a job due to a lost provisioner daemon.
This commit is contained in:
Spike Curtis 2023-12-11 14:52:44 +04:00 committed by GitHub
parent 50575e1a9a
commit 8d9157dc35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -274,7 +274,8 @@ func (s *server) AcquireJobWithCancel(stream proto.DRPCProvisionerDaemon_Acquire
// in the database. We need to mark this job as failed so the end user can retry if they want to.
now := dbtime.Now()
err := s.Database.UpdateProvisionerJobWithCompleteByID(
context.Background(),
//nolint:gocritic // Provisionerd has specific authz rules.
dbauthz.AsProvisionerd(context.Background()),
database.UpdateProvisionerJobWithCompleteByIDParams{
ID: je.job.ID,
CompletedAt: sql.NullTime{