Skip to content

Commit

Permalink
Merge pull request #8259 from legal90/parallels-host-ip
Browse files Browse the repository at this point in the history
Add HostIP implementation for parallels driver
  • Loading branch information
medyagh committed May 26, 2020
2 parents ad437c2 + 2b8bac6 commit 20179ef
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
19 changes: 19 additions & 0 deletions pkg/minikube/cluster/ip.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,25 @@ func HostIP(host *host.Host) (net.IP, error) {
re = regexp.MustCompile(`(?s)Name:\s*` + iface + `.+IPAddress:\s*(\S+)`)
ip := re.FindStringSubmatch(string(ipList))[1]
return net.ParseIP(ip), nil
case driver.Parallels:
bin := "prlsrvctl"
var binPath string
if fullPath, err := exec.LookPath(bin); err != nil {
binPath = fullPath
} else {
binPath = bin
}
out, err := exec.Command(binPath, "net", "info", "Shared").Output()
if err != nil {
return []byte{}, errors.Wrap(err, "Error reading the info of Parallels Shared network interface")
}
re := regexp.MustCompile(`IPv4 address: (.*)`)
ipMatch := re.FindStringSubmatch(string(out))
if len(ipMatch) < 2 {
return []byte{}, errors.Wrap(err, "Error getting the IP address of Parallels Shared network interface")
}
ip := ipMatch[1]
return net.ParseIP(ip), nil
case driver.HyperKit:
return net.ParseIP("192.168.64.1"), nil
case driver.VMware:
Expand Down
1 change: 0 additions & 1 deletion pkg/minikube/driver/driver_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
// supportedDrivers is a list of supported drivers on Linux.
var supportedDrivers = []string{
VirtualBox,
Parallels,
VMwareFusion,
KVM2,
VMware,
Expand Down

0 comments on commit 20179ef

Please sign in to comment.