Skip to content

Commit 3e3caa7

Browse files
committed
fix: remove context.Background references
1 parent 6db3d4d commit 3e3caa7

File tree

9 files changed

+11
-11
lines changed

9 files changed

+11
-11
lines changed

internal/auth/ldap/repository_auth_method_create.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func (r *Repository) CreateAuthMethod(ctx context.Context, am *AuthMethod, opt .
6262
return nil, errors.Wrap(ctx, err, op)
6363
}
6464

65-
dbWrapper, err := r.kms.GetWrapper(context.Background(), am.ScopeId, kms.KeyPurposeDatabase)
65+
dbWrapper, err := r.kms.GetWrapper(ctx, am.ScopeId, kms.KeyPurposeDatabase)
6666
if err != nil {
6767
return nil, errors.Wrap(ctx, err, op, errors.WithMsg("unable to get database wrapper"))
6868
}

internal/auth/oidc/repository_auth_method_create.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func (r *Repository) CreateAuthMethod(ctx context.Context, am *AuthMethod, opt .
6161
return nil, errors.Wrap(ctx, err, op, errors.WithMsg("unable to get oplog wrapper"))
6262
}
6363

64-
databaseWrapper, err := r.kms.GetWrapper(context.Background(), am.ScopeId, kms.KeyPurposeDatabase)
64+
databaseWrapper, err := r.kms.GetWrapper(ctx, am.ScopeId, kms.KeyPurposeDatabase)
6565
if err != nil {
6666
return nil, errors.Wrap(ctx, err, op, errors.WithMsg("unable to get database wrapper"))
6767
}

internal/credential/vault/jobs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ func nextRenewal(ctx context.Context, j scheduler.Job) (time.Duration, error) {
264264
return 0, errors.New(ctx, errors.Unknown, op, "unknown job")
265265
}
266266

267-
rows, err := r.Query(context.Background(), query, nil)
267+
rows, err := r.Query(ctx, query, nil)
268268
if err != nil {
269269
return 0, errors.Wrap(ctx, err, op)
270270
}

internal/credential/vault/vault_token.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ func newToken(ctx context.Context, storeId string, token TokenSecret, accessor [
7575
accessorCopy := make([]byte, len(accessor))
7676
copy(accessorCopy, accessor)
7777

78-
hmac, err := crypto.HmacSha256WithPrk(context.Background(), tokenCopy, accessorCopy)
78+
hmac, err := crypto.HmacSha256WithPrk(ctx, tokenCopy, accessorCopy)
7979
if err != nil {
8080
return nil, errors.Wrap(ctx, err, op, errors.WithCode(errors.Encrypt))
8181
}

internal/daemon/controller/handler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,7 @@ func wrapHandlerWithCallbackInterceptor(h http.Handler, c *Controller) http.Hand
686686

687687
if strings.HasSuffix(req.URL.Path, "oidc:authenticate") {
688688
if s, ok := values["state"].(string); ok {
689-
stateWrapper, err := oidc.UnwrapMessage(context.Background(), s)
689+
stateWrapper, err := oidc.UnwrapMessage(ctx, s)
690690
if err != nil {
691691
event.WriteError(ctx, op, err, event.WithInfoMsg("error marshaling state"))
692692
w.WriteHeader(http.StatusInternalServerError)

internal/host/plugin/job_set_sync.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ func nextSync(ctx context.Context, j scheduler.Job) (time.Duration, error) {
148148
return 0, errors.New(ctx, errors.Unknown, op, "unknown job")
149149
}
150150

151-
rows, err := r.Query(context.Background(), query, []any{setSyncJobRunInterval})
151+
rows, err := r.Query(ctx, query, []any{setSyncJobRunInterval})
152152
if err != nil {
153153
return 0, errors.Wrap(ctx, err, op)
154154
}

internal/iam/repository_user.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ func (r *Repository) LookupUserWithLogin(ctx context.Context, accountId string,
234234

235235
acct := allocAccount()
236236
acct.PublicId = accountId
237-
err = r.reader.LookupByPublicId(context.Background(), &acct)
237+
err = r.reader.LookupByPublicId(ctx, &acct)
238238
if err != nil {
239239
return nil, errors.Wrap(ctx, err, op, errors.WithMsg(fmt.Sprintf("unable to lookup account %s", accountId)))
240240
}
@@ -329,7 +329,7 @@ func (r *Repository) allowUserAutoVivify(ctx context.Context, acct *authAccount)
329329
}
330330
acctScope := AllocScope()
331331
acctScope.PublicId = acct.ScopeId
332-
err := r.reader.LookupByPublicId(context.Background(), &acctScope)
332+
err := r.reader.LookupByPublicId(ctx, &acctScope)
333333
if err != nil {
334334
return false, errors.Wrap(ctx, err, op, errors.WithMsg(fmt.Sprintf("unable to lookup account's scope %s", acct.ScopeId)))
335335
}
@@ -733,7 +733,7 @@ func dissociateUserFromAccounts(ctx context.Context, repoKms *kms.Kms, reader db
733733
for _, accountId := range accountIds {
734734
acct := allocAccount()
735735
acct.PublicId = accountId
736-
err := reader.LookupByPublicId(context.Background(), &acct)
736+
err := reader.LookupByPublicId(ctx, &acct)
737737
if err != nil {
738738
return errors.Wrap(ctx, err, op, errors.WithMsg(fmt.Sprintf("unable to lookup account %s", accountId)))
739739
}

internal/oplog/writer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func (w *Writer) hasTable(ctx context.Context, tableName string) (bool, error) {
2525
}
2626
var count int64
2727
rw := dbw.New(w.DB)
28-
rows, err := rw.Query(context.Background(), "select count(*) from information_schema.tables where table_name = ? and table_type = ?", []any{tableName, "BASE TABLE"})
28+
rows, err := rw.Query(ctx, "select count(*) from information_schema.tables where table_name = ? and table_type = ?", []any{tableName, "BASE TABLE"})
2929
if err != nil {
3030
return false, errors.Wrap(ctx, err, op)
3131
}

internal/server/repository_worker.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ func (r *Repository) CreateWorker(ctx context.Context, worker *Worker, opt ...Op
642642

643643
var workerAuthRepo *WorkerAuthRepositoryStorage
644644

645-
databaseWrapper, err := r.kms.GetWrapper(context.Background(), worker.ScopeId, kms.KeyPurposeDatabase)
645+
databaseWrapper, err := r.kms.GetWrapper(ctx, worker.ScopeId, kms.KeyPurposeDatabase)
646646
if err != nil {
647647
return nil, errors.Wrap(ctx, err, op, errors.WithMsg("unable to get database wrapper"))
648648
}

0 commit comments

Comments
 (0)