Update host plugin RPC to return sets from ListHosts (#1557)
A few other minor tweaks as well.
This commit is contained in:
1 parent
bbfef2802f
commit
8fb1898c3e
4 files changed
+139
-112
No files matched your search
@@ -81,8 +81,8 @@ func (r *Repository) CreateCatalog(ctx context.Context, c *HostCatalog, _ ...Opt
|
||||
}
|
||||
|
||||
var hcSecret *HostCatalogSecret
|
||||
if plgResp != nil && plgResp.GetPersisted().GetData() != nil {
|
||||
hcSecret, err = newHostCatalogSecret(ctx, id, plgResp.GetPersisted().GetData())
|
||||
if plgResp != nil && plgResp.GetPersisted().GetSecrets() != nil {
|
||||
hcSecret, err = newHostCatalogSecret(ctx, id, plgResp.GetPersisted().GetSecrets())
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(ctx, err, op)
|
||||
}
|
||||
@@ -229,11 +229,11 @@ func (r *Repository) getPersistedDataForCatalog(ctx context.Context, c *HostCata
|
||||
return nil, errors.Wrap(ctx, err, op)
|
||||
}
|
||||
|
||||
data := &structpb.Struct{}
|
||||
if err := proto.Unmarshal(cSecret.GetSecret(), data); err != nil {
|
||||
secrets := &structpb.Struct{}
|
||||
if err := proto.Unmarshal(cSecret.GetSecret(), secrets); err != nil {
|
||||
return nil, errors.Wrap(ctx, err, op, errors.WithMsg("unmarshaling secret"))
|
||||
}
|
||||
return &plgpb.HostCatalogPersisted{Data: data}, nil
|
||||
return &plgpb.HostCatalogPersisted{Secrets: secrets}, nil
|
||||
}
|
||||
|
||||
// toPluginCatalog returns a host catalog, with it's secret if available, in the format expected
|
||||
|
||||
@@ -38,7 +38,7 @@ func TestRepository_CreateCatalog(t *testing.T) {
|
||||
plg.GetPublicId(): &TestPluginServer{
|
||||
OnCreateCatalogFn: func(_ context.Context, req *plgpb.OnCreateCatalogRequest) (*plgpb.OnCreateCatalogResponse, error) {
|
||||
gotPluginAttrs = req.GetCatalog().GetAttributes()
|
||||
return &plgpb.OnCreateCatalogResponse{Persisted: &plgpb.HostCatalogPersisted{Data: req.GetCatalog().GetSecrets()}}, nil
|
||||
return &plgpb.OnCreateCatalogResponse{Persisted: &plgpb.HostCatalogPersisted{Secrets: req.GetCatalog().GetSecrets()}}, nil
|
||||
},
|
||||
},
|
||||
unimplementedPlugin.GetPublicId(): &plgpb.UnimplementedHostPluginServiceServer{},
|
||||
|
||||
Reference in new issue
Block a user