Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

18529 nomad executes any file in plugins #18530

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion helper/pluginutils/loader/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion helper/pluginutils/loader/loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)
Expand Down