e2e/cli: use discover utility for nomad binary

This commit is contained in:
Nick Ethier 2018-07-24 12:21:48 -04:00
parent 33bb3d6a84
commit d44f5cbf4e
No known key found for this signature in database
GPG key ID: 07C1A3ECED90D24A

View file

@ -15,6 +15,7 @@ import (
"strings"
getter "github.com/hashicorp/go-getter"
"github.com/hashicorp/nomad/helper/discover"
"github.com/mitchellh/cli"
)
@ -127,6 +128,12 @@ func (c *Provision) fetchBinary(bin string) (string, error) {
return "", fmt.Errorf("failed to create temp dir: %v", err)
}
if bin == "" {
bin, err = discover.NomadExecutable()
if err != nil {
return "", fmt.Errorf("failed to discover nomad binary: %v", err)
}
}
if err = getter.GetFile(path.Join(nomadBinaryDir, "nomad"), bin); err != nil {
return "", fmt.Errorf("failed to get nomad binary: %v", err)
}