mirror of
https://github.com/grafana/grafana.git
synced 2025-09-21 04:52:48 +08:00
Plugins: Remove old code related to Core plugin installs (#44311)
* remove old code * remove even more * skip flaky test
This commit is contained in:
@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/url"
|
||||
"os"
|
||||
"path"
|
||||
@ -19,7 +18,6 @@ import (
|
||||
"github.com/grafana/grafana/pkg/infra/metrics"
|
||||
"github.com/grafana/grafana/pkg/models"
|
||||
"github.com/grafana/grafana/pkg/plugins"
|
||||
"github.com/grafana/grafana/pkg/plugins/backendplugin"
|
||||
"github.com/grafana/grafana/pkg/plugins/manager/loader/finder"
|
||||
"github.com/grafana/grafana/pkg/plugins/manager/loader/initializer"
|
||||
"github.com/grafana/grafana/pkg/plugins/manager/signature"
|
||||
@ -70,37 +68,6 @@ func (l *Loader) Load(ctx context.Context, class plugins.Class, paths []string,
|
||||
return l.loadPlugins(ctx, class, pluginJSONPaths, ignore)
|
||||
}
|
||||
|
||||
func (l *Loader) LoadWithFactory(ctx context.Context, class plugins.Class, path string, factory backendplugin.PluginFactoryFunc) (*plugins.Plugin, error) {
|
||||
p, err := l.load(ctx, class, path, map[string]struct{}{})
|
||||
if err != nil {
|
||||
l.log.Error("failed to load core plugin", "err", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = l.pluginInitializer.InitializeWithFactory(p, factory)
|
||||
|
||||
return p, err
|
||||
}
|
||||
|
||||
func (l *Loader) load(ctx context.Context, class plugins.Class, path string, ignore map[string]struct{}) (*plugins.Plugin, error) {
|
||||
pluginJSONPaths, err := l.pluginFinder.Find([]string{path})
|
||||
if err != nil {
|
||||
l.log.Error("failed to find plugin", "err", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
loadedPlugins, err := l.loadPlugins(ctx, class, pluginJSONPaths, ignore)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(loadedPlugins) == 0 {
|
||||
return nil, fmt.Errorf("could not load plugin at path %s", path)
|
||||
}
|
||||
|
||||
return loadedPlugins[0], nil
|
||||
}
|
||||
|
||||
func (l *Loader) loadPlugins(ctx context.Context, class plugins.Class, pluginJSONPaths []string, existingPlugins map[string]struct{}) ([]*plugins.Plugin, error) {
|
||||
var foundPlugins = foundPlugins{}
|
||||
|
||||
|
Reference in New Issue
Block a user