diff --git a/command/agent/config.go b/command/agent/config.go index 69a14d766..0767b98f9 100644 --- a/command/agent/config.go +++ b/command/agent/config.go @@ -7,6 +7,7 @@ import ( "io" "net" "os" + "os/exec" "os/user" "path/filepath" "runtime" @@ -705,6 +706,10 @@ func newDevModeConfig(devMode, connectMode bool) (*devModeConfig, error) { return nil, fmt.Errorf( "-dev-connect uses network namespaces and is only supported for root.") } + // Ensure Consul is on PATH + if _, err := exec.LookPath("consul"); err != nil { + return nil, fmt.Errorf("-dev-connect requires a 'consul' binary in Nomad's $PATH") + } mode.connectMode = true } err := mode.networkConfig()