@@ -11,6 +11,7 @@ import (
1111 "github.com/hashicorp/boundary/internal/db"
1212 "github.com/hashicorp/boundary/internal/errors"
1313 "github.com/hashicorp/boundary/internal/event"
14+ "github.com/hashicorp/boundary/internal/host"
1415 "github.com/hashicorp/boundary/internal/kms"
1516 "github.com/hashicorp/boundary/internal/libs/patchstruct"
1617 "github.com/hashicorp/boundary/internal/oplog"
@@ -404,7 +405,7 @@ func (r *Repository) UpdateCatalog(ctx context.Context, c *HostCatalog, version
404405 ctx ,
405406 db .StdRetryCnt ,
406407 db.ExpBackoff {},
407- func (_ db.Reader , w db.Writer ) error {
408+ func (read db.Reader , w db.Writer ) error {
408409 msgs := make ([]* oplog.Message , 0 , 3 )
409410 ticket , err := w .GetTicket (ctx , newCatalog )
410411 if err != nil {
@@ -528,7 +529,7 @@ func (r *Repository) UpdateCatalog(ctx context.Context, c *HostCatalog, version
528529 if needSetSync {
529530 // We also need to mark all host sets in this catalog to be
530531 // synced as well.
531- setsForCatalog , _ , err := r .getSets (ctx , "" , returnedCatalog .PublicId )
532+ setsForCatalog , _ , err := r .getSets (ctx , "" , returnedCatalog .PublicId , host . WithReaderWriter ( read , w ) )
532533 if err != nil {
533534 return errors .Wrap (ctx , err , op , errors .WithMsg ("unable to get sets for host catalog" ))
534535 }
@@ -713,14 +714,19 @@ func (r *Repository) getCatalog(ctx context.Context, id string) (*HostCatalog, *
713714 return c , p , nil
714715}
715716
716- func (r * Repository ) getPlugin (ctx context.Context , plgId string ) (* plg.Plugin , error ) {
717+ func (r * Repository ) getPlugin (ctx context.Context , plgId string , opts ... Option ) (* plg.Plugin , error ) {
717718 const op = "plugin.(Repository).getPlugin"
718719 if plgId == "" {
719720 return nil , errors .New (ctx , errors .InvalidParameter , op , "no plugin id" )
720721 }
722+ opt := getOpts (opts ... )
723+ reader := r .reader
724+ if ! util .IsNil (opt .WithReader ) {
725+ reader = opt .WithReader
726+ }
721727 plg := plg .NewPlugin ()
722728 plg .PublicId = plgId
723- if err := r . reader .LookupByPublicId (ctx , plg ); err != nil {
729+ if err := reader .LookupByPublicId (ctx , plg ); err != nil {
724730 return nil , errors .Wrap (ctx , err , op , errors .WithMsg (fmt .Sprintf ("unable to get host plugin with id %q" , plgId )))
725731 }
726732 return plg , nil
0 commit comments