Merge pull request #6282 from hashicorp/f-connect-dev-path

connect: check if consul is on PATH
This commit is contained in:
Michael Schurter
2019-09-05 12:25:23 -07:00
committed by GitHub

View File

@@ -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()