Plugins: Only load transform plug-ins if expressions feature on (#24110)
* PluginManager: Only load transform plugins if expressions feature on Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
This commit is contained in:
co-authored by
Marcus Efraimsson
parent
89db44e6f3
commit
2fc2a7c3f5
+12
-2
@@ -241,7 +241,7 @@ func (scanner *PluginScanner) walker(currentPath string, f os.FileInfo, err erro
|
||||
}
|
||||
|
||||
if f.Name() == "plugin.json" {
|
||||
err := scanner.loadPluginJson(currentPath)
|
||||
err := scanner.loadPlugin(currentPath)
|
||||
if err != nil {
|
||||
scanner.log.Error("Failed to load plugin", "error", err, "pluginPath", filepath.Dir(currentPath))
|
||||
scanner.errors = append(scanner.errors, err)
|
||||
@@ -250,7 +250,7 @@ func (scanner *PluginScanner) walker(currentPath string, f os.FileInfo, err erro
|
||||
return nil
|
||||
}
|
||||
|
||||
func (scanner *PluginScanner) loadPluginJson(pluginJsonFilePath string) error {
|
||||
func (scanner *PluginScanner) loadPlugin(pluginJsonFilePath string) error {
|
||||
currentDir := filepath.Dir(pluginJsonFilePath)
|
||||
reader, err := os.Open(pluginJsonFilePath)
|
||||
if err != nil {
|
||||
@@ -269,6 +269,16 @@ func (scanner *PluginScanner) loadPluginJson(pluginJsonFilePath string) error {
|
||||
return errors.New("did not find type or id properties in plugin.json")
|
||||
}
|
||||
|
||||
// The expressions feature toggle corresponds to transform plug-ins.
|
||||
if pluginCommon.Type == "transform" {
|
||||
isEnabled := scanner.cfg.IsExpressionsEnabled()
|
||||
if !isEnabled {
|
||||
scanner.log.Debug("Transform plugin is disabled since the expressions feature toggle is not enabled",
|
||||
"pluginID", pluginCommon.Id)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
pluginCommon.PluginDir = filepath.Dir(pluginJsonFilePath)
|
||||
|
||||
// For the time being, we choose to only require back-end plugins to be signed
|
||||
|
||||
Reference in New Issue
Block a user