builder/vmware: check for ifconfig in /sbin [GH-591]
This commit is contained in:
parent
cf0ac15ecc
commit
7aab3381f1
|
@ -22,6 +22,7 @@ BUG FIXES:
|
||||||
[GH-554]
|
[GH-554]
|
||||||
* builder/openstack: Properly scrub password from logs [GH-554]
|
* builder/openstack: Properly scrub password from logs [GH-554]
|
||||||
* builder/virtualbox: No panic if SSH host port min/max is the same. [GH-594]
|
* builder/virtualbox: No panic if SSH host port min/max is the same. [GH-594]
|
||||||
|
* builder/vmware: checks if `ifconfig` is in `/sbin` [GH-591]
|
||||||
* builder/vmware: Host IP lookup works for non-C locales. [GH-592]
|
* builder/vmware: Host IP lookup works for non-C locales. [GH-592]
|
||||||
* common/uuid: Use cryptographically secure PRNG when generating
|
* common/uuid: Use cryptographically secure PRNG when generating
|
||||||
UUIDs. [GH-552]
|
UUIDs. [GH-552]
|
||||||
|
|
|
@ -3,6 +3,7 @@ package vmware
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"errors"
|
"errors"
|
||||||
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"regexp"
|
"regexp"
|
||||||
)
|
)
|
||||||
|
@ -13,10 +14,21 @@ type IfconfigIPFinder struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *IfconfigIPFinder) HostIP() (string, error) {
|
func (f *IfconfigIPFinder) HostIP() (string, error) {
|
||||||
ifconfigPath, err := exec.LookPath("ifconfig")
|
var ifconfigPath string
|
||||||
|
|
||||||
|
// On some systems, ifconfig is in /sbin which is generally not
|
||||||
|
// on the PATH for a standard user, so we just check that first.
|
||||||
|
if _, err := os.Stat("/sbin/ifconfig"); err == nil {
|
||||||
|
ifconfigPath = "/sbin/ifconfig"
|
||||||
|
}
|
||||||
|
|
||||||
|
if ifconfigPath == "" {
|
||||||
|
var err error
|
||||||
|
ifconfigPath, err = exec.LookPath("ifconfig")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
stdout := new(bytes.Buffer)
|
stdout := new(bytes.Buffer)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue