mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 18:35:44 +03:00
loader and singleton
This commit is contained in:
committed by
Michael Schurter
parent
b9f36134dc
commit
c19cd2e5cf
26
pluginutils/loader/util.go
Normal file
26
pluginutils/loader/util.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package loader
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/hashicorp/nomad/nomad/structs/config"
|
||||
)
|
||||
|
||||
// configMap returns a mapping of plugin binary name to config.
|
||||
func configMap(configs []*config.PluginConfig) map[string]*config.PluginConfig {
|
||||
pluginMapping := make(map[string]*config.PluginConfig, len(configs))
|
||||
for _, c := range configs {
|
||||
pluginMapping[c.Name] = c
|
||||
}
|
||||
return pluginMapping
|
||||
}
|
||||
|
||||
// cleanPluginExecutable strips the executable name of common suffixes
|
||||
func cleanPluginExecutable(name string) string {
|
||||
switch {
|
||||
case strings.HasSuffix(name, ".exe"):
|
||||
return strings.TrimSuffix(name, ".exe")
|
||||
default:
|
||||
return name
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user