feat(host/plugin): Use plugin client pkg func on job_set_sync

This commit is contained in:
Hugo committed 2024-09-30 21:24:18 +01:00
1 parent 5b5aa484da
commit a5237cc171
1 file changed
+7 -5
+7 -5
View File
@@ -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 {
@@ -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)
@@ -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)