2016-02-02 21:38:38 +00:00
|
|
|
package command
|
|
|
|
|
|
|
|
import (
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
"github.com/hashicorp/go-plugin"
|
|
|
|
|
|
|
|
"github.com/hashicorp/nomad/client/driver/plugins"
|
|
|
|
)
|
|
|
|
|
2016-02-02 22:36:11 +00:00
|
|
|
type ExecutorPluginCommand struct {
|
2016-02-02 21:38:38 +00:00
|
|
|
Meta
|
|
|
|
}
|
|
|
|
|
2016-02-02 22:36:11 +00:00
|
|
|
func (e *ExecutorPluginCommand) Help() string {
|
2016-02-02 21:38:38 +00:00
|
|
|
helpText := `
|
|
|
|
This is a command used by Nomad internally to launch an executor plugin"
|
|
|
|
`
|
|
|
|
return strings.TrimSpace(helpText)
|
|
|
|
}
|
|
|
|
|
2016-02-02 22:36:11 +00:00
|
|
|
func (e *ExecutorPluginCommand) Synopsis() string {
|
2016-02-02 21:38:38 +00:00
|
|
|
return "internal - launch an executor plugin"
|
|
|
|
}
|
|
|
|
|
2016-02-02 22:36:11 +00:00
|
|
|
func (e *ExecutorPluginCommand) Run(args []string) int {
|
2016-02-02 21:38:38 +00:00
|
|
|
plugin.Serve(&plugin.ServeConfig{
|
|
|
|
HandshakeConfig: plugins.HandshakeConfig,
|
|
|
|
Plugins: plugins.PluginMap,
|
|
|
|
})
|
|
|
|
return 0
|
|
|
|
}
|