Skip to content

Commit

Permalink
feat(host/plugin): Use plugin client pkg func on job_set_sync
Browse files Browse the repository at this point in the history
  • Loading branch information
hugoghx committed Sep 27, 2024
1 parent 7a41e33 commit 1f210b5
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions internal/host/plugin/job_set_sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,6 @@ func (r *SetSyncJob) syncSets(ctx context.Context, setAggs []*hostSetAgg) error
setInfos: make(map[string]*setInfo),
}
}
ci.plg, ok = r.plugins[ag.PluginId]
if !ok {
return errors.New(ctx, errors.Internal, op, fmt.Sprintf("expected plugin %q not available", ag.PluginId))
}

s, err := ag.toHostSet(ctx)
if err != nil {
Expand All @@ -244,7 +240,8 @@ func (r *SetSyncJob) syncSets(ctx context.Context, setAggs []*hostSetAgg) error
catalogInfos[ag.CatalogId] = ci
}

// Now, look up the catalog persisted (secret) information
// Now, look up the catalog persisted (secret) information. Additionally,
// find the correct plugin to use.
catIds := make([]string, 0, len(catalogInfos))
for k := range catalogInfos {
catIds = append(catIds, k)
Expand All @@ -269,6 +266,11 @@ func (r *SetSyncJob) syncSets(ctx context.Context, setAggs []*hostSetAgg) error
ci.plgCat = plgCat
ci.storeCat = c

ci.plg, err = pluginClientFactoryFn(ctx, ci.plgCat, r.plugins)
if err != nil {
return errors.Wrap(ctx, err, op, errors.WithMsg("failed to get plugin client"))
}

per, err := toPluginPersistedData(ctx, r.kms, c.GetProjectId(), s)
if err != nil {
return errors.Wrap(ctx, err, op)
Expand Down

0 comments on commit 1f210b5

Please sign in to comment.