2015-08-20 23:50:28 +00:00
|
|
|
package driver
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
|
|
|
|
"github.com/hashicorp/nomad/nomad/structs"
|
|
|
|
)
|
|
|
|
|
|
|
|
// ExecDriver is the simplest possible driver. It literally just
|
|
|
|
// fork/execs tasks. It should probably not be used for most things,
|
|
|
|
// but is useful for testing purposes or for very simple tasks.
|
|
|
|
type ExecDriver struct {
|
|
|
|
logger *log.Logger
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewExecDriver is used to create a new exec driver
|
|
|
|
func NewExecDriver(logger *log.Logger) Driver {
|
|
|
|
d := &ExecDriver{
|
|
|
|
logger: logger,
|
|
|
|
}
|
|
|
|
return d
|
|
|
|
}
|
|
|
|
|
2015-08-20 23:53:43 +00:00
|
|
|
func (d *ExecDriver) Fingerprint(node *structs.Node) (bool, error) {
|
2015-08-20 23:50:28 +00:00
|
|
|
// We can always do a fork/exec
|
2015-08-20 23:53:43 +00:00
|
|
|
node.Attributes["driver.exec"] = "1"
|
2015-08-20 23:50:28 +00:00
|
|
|
return true, nil
|
|
|
|
}
|