Advisor: Define error if a datasource doesn't have its plugin installed (#103200)

This commit is contained in:
Andres Martinez Gotor
2025-04-02 11:21:37 +02:00
committed by GitHub
parent f2b5b4e0c0
commit 3777b765b9
2 changed files with 53 additions and 0 deletions
@@ -138,6 +138,24 @@ func (s *healthCheckStep) Run(ctx context.Context, obj *advisor.CheckSpec, i any
}
pCtx, err := s.PluginContextProvider.GetWithDataSource(ctx, ds.Type, requester, ds)
if err != nil {
if errors.Is(err, plugins.ErrPluginNotRegistered) {
// The plugin is not installed
return checks.NewCheckReportFailure(
advisor.CheckReportFailureSeverityHigh,
s.ID(),
ds.Name,
[]advisor.CheckErrorLink{
{
Message: "Delete data source",
Url: fmt.Sprintf("/connections/datasources/edit/%s", ds.UID),
},
{
Message: "Install plugin",
Url: fmt.Sprintf("/plugins/%s", ds.Type),
},
},
), nil
}
// Unable to check health check
s.log.Error("Failed to get plugin context", "datasource_uid", ds.UID, "error", err)
return nil, nil