@@ -11,6 +11,7 @@ import (
11
11
"github.com/hashicorp/boundary/internal/db"
12
12
"github.com/hashicorp/boundary/internal/errors"
13
13
"github.com/hashicorp/boundary/internal/event"
14
+ "github.com/hashicorp/boundary/internal/host"
14
15
"github.com/hashicorp/boundary/internal/kms"
15
16
"github.com/hashicorp/boundary/internal/libs/patchstruct"
16
17
"github.com/hashicorp/boundary/internal/oplog"
@@ -395,7 +396,7 @@ func (r *Repository) UpdateCatalog(ctx context.Context, c *HostCatalog, version
395
396
ctx ,
396
397
db .StdRetryCnt ,
397
398
db.ExpBackoff {},
398
- func (_ db.Reader , w db.Writer ) error {
399
+ func (read db.Reader , w db.Writer ) error {
399
400
msgs := make ([]* oplog.Message , 0 , 3 )
400
401
ticket , err := w .GetTicket (ctx , newCatalog )
401
402
if err != nil {
@@ -517,7 +518,7 @@ func (r *Repository) UpdateCatalog(ctx context.Context, c *HostCatalog, version
517
518
if needSetSync {
518
519
// We also need to mark all host sets in this catalog to be
519
520
// synced as well.
520
- setsForCatalog , _ , err := r .getSets (ctx , "" , returnedCatalog .PublicId )
521
+ setsForCatalog , _ , err := r .getSets (ctx , "" , returnedCatalog .PublicId , host . WithReaderWriter ( read , w ) )
521
522
if err != nil {
522
523
return errors .Wrap (ctx , err , op , errors .WithMsg ("unable to get sets for host catalog" ))
523
524
}
@@ -697,14 +698,19 @@ func (r *Repository) getCatalog(ctx context.Context, id string) (*HostCatalog, *
697
698
return c , p , nil
698
699
}
699
700
700
- func (r * Repository ) getPlugin (ctx context.Context , plgId string ) (* plg.Plugin , error ) {
701
+ func (r * Repository ) getPlugin (ctx context.Context , plgId string , opts ... Option ) (* plg.Plugin , error ) {
701
702
const op = "plugin.(Repository).getPlugin"
702
703
if plgId == "" {
703
704
return nil , errors .New (ctx , errors .InvalidParameter , op , "no plugin id" )
704
705
}
706
+ opt := getOpts (opts ... )
707
+ reader := r .reader
708
+ if ! util .IsNil (opt .WithReader ) {
709
+ reader = opt .WithReader
710
+ }
705
711
plg := plg .NewPlugin ()
706
712
plg .PublicId = plgId
707
- if err := r . reader .LookupByPublicId (ctx , plg ); err != nil {
713
+ if err := reader .LookupByPublicId (ctx , plg ); err != nil {
708
714
return nil , errors .Wrap (ctx , err , op , errors .WithMsg (fmt .Sprintf ("unable to get host plugin with id %q" , plgId )))
709
715
}
710
716
return plg , nil
0 commit comments