Skip to content

Commit

Permalink
Better parsing of raw_exec option and updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dadgar committed Oct 9, 2015
1 parent c4e4861 commit bbdceca
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions client/driver/raw_exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions website/source/docs/drivers/raw_exec.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit bbdceca

Please sign in to comment.