Better parsing of raw_exec option and updated docs

This commit is contained in:
Alex Dadgar
2015-10-09 11:29:59 -07:00
parent c4e4861889
commit bbdceca358
2 changed files with 8 additions and 4 deletions

View File

@@ -46,8 +46,12 @@ func NewRawExecDriver(ctx *DriverContext) Driver {
func (d *RawExecDriver) Fingerprint(cfg *config.Config, node *structs.Node) (bool, error) {
// Check that the user has explicitly enabled this executor.
enabled := strings.ToLower(cfg.ReadDefault(rawExecConfigOption, "false"))
if enabled == "1" || enabled == "true" {
enabled, err := strconv.ParseBool(cfg.ReadDefault(rawExecConfigOption, "false"))
if err != nil {
return false, fmt.Errorf("Failed to parse %v option: %v", rawExecConfigOption, err)
}
if enabled {
d.logger.Printf("[WARN] driver.raw_exec: raw exec is enabled. Only enable if needed")
node.Attributes["driver.raw_exec"] = "1"
return true, nil

View File

@@ -11,8 +11,8 @@ description: |-
Name: `raw_exec`
The `raw_exec` driver is used to execute a command for a task without any
resource isolation. As such, it should be used with extreme care and is disabled
by default.
isolation. Further, the task is started as the same user as the Nomad process.
As such, it should be used with extreme care and is disabled by default.
## Task Configuration