diff --git a/helper/pluginutils/loader/init.go b/helper/pluginutils/loader/init.go index d43636cf02d..3fb262df23c 100644 --- a/helper/pluginutils/loader/init.go +++ b/helper/pluginutils/loader/init.go @@ -264,7 +264,11 @@ func (l *PluginLoader) fingerprintPlugins(plugins []os.FileInfo, configs map[str fingerprinted := make(map[PluginID]*pluginInfo, len(plugins)) for _, p := range plugins { name := cleanPluginExecutable(p.Name()) - c := configs[name] + c, config_does_exist := configs[name] + if !config_does_exist { + l.logger.Error("failed to load config for plugin. Is it specified in the config?", "plugin", name) + continue + } info, err := l.fingerprintPlugin(p, c) if err != nil { l.logger.Error("failed to fingerprint plugin", "plugin", name, "error", err) diff --git a/helper/pluginutils/loader/loader_test.go b/helper/pluginutils/loader/loader_test.go index 939ee7b7104..1f8a50d1730 100644 --- a/helper/pluginutils/loader/loader_test.go +++ b/helper/pluginutils/loader/loader_test.go @@ -103,7 +103,7 @@ func TestPluginLoader_External(t *testing.T) { require := require.New(t) // Create two plugins - plugins := []string{"mock-device", "mock-device-2"} + plugins := []string{"mock-device", "mock-device-2", "mock-device-3"} pluginVersions := []string{"v0.0.1", "v0.0.2"} h := newHarness(t, plugins) @@ -133,6 +133,8 @@ func TestPluginLoader_External(t *testing.T) { require.NoError(err) // Get the catalog and assert we have the two plugins + // + // Note: mock-device-3 is ignored because it does not have a related config. c := l.Catalog() require.Len(c, 1) require.Contains(c, base.PluginTypeDevice)