Plugins: Remove direct featuremgmt.FeatureToggles dependency from plugins config (#84482)

This commit is contained in:
Will Browne
2024-03-15 10:58:51 +01:00
committed by GitHub
parent c13e248384
commit 9d453d0dcc
13 changed files with 58 additions and 75 deletions
@@ -15,7 +15,6 @@ import (
"github.com/grafana/grafana/pkg/plugins/manager/registry"
"github.com/grafana/grafana/pkg/plugins/manager/signature"
"github.com/grafana/grafana/pkg/plugins/pfs"
"github.com/grafana/grafana/pkg/services/featuremgmt"
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginerrs"
)
@@ -177,7 +176,7 @@ func NewAsExternalStep(cfg *config.PluginManagementCfg) *AsExternal {
// Filter will filter out any plugins that are marked to be disabled.
func (c *AsExternal) Filter(cl plugins.Class, bundles []*plugins.FoundBundle) ([]*plugins.FoundBundle, error) {
if c.cfg.Features == nil || !c.cfg.Features.IsEnabledGlobally(featuremgmt.FlagExternalCorePlugins) {
if !c.cfg.Features.ExternalCorePluginsEnabled {
return bundles, nil
}
@@ -9,7 +9,6 @@ import (
"github.com/grafana/grafana/pkg/plugins"
"github.com/grafana/grafana/pkg/plugins/config"
"github.com/grafana/grafana/pkg/plugins/manager/registry"
"github.com/grafana/grafana/pkg/services/featuremgmt"
"github.com/grafana/grafana/pkg/setting"
)
@@ -69,7 +68,9 @@ func TestAsExternal(t *testing.T) {
t.Run("should skip a core plugin", func(t *testing.T) {
cfg := &config.PluginManagementCfg{
Features: featuremgmt.WithFeatures(featuremgmt.FlagExternalCorePlugins),
Features: config.Features{
ExternalCorePluginsEnabled: true,
},
PluginSettings: setting.PluginSettings{
"plugin1": map[string]string{
"as_external": "true",