Skip to content

Commit

Permalink
Fixed host IP detection
Browse files Browse the repository at this point in the history
  • Loading branch information
rickard-von-essen committed Mar 19, 2014
1 parent 04684c3 commit f4f027c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
2 changes: 1 addition & 1 deletion iso/host_ip_ifconfig.go
Expand Up @@ -45,7 +45,7 @@ func (f *IfconfigIPFinder) HostIP() (string, error) {
return "", err
}

re := regexp.MustCompile(`inet\s*(?:addr:)?(.+?)\s`)
re := regexp.MustCompile(`inet\s+(?:addr:)?(.+?)\s`)
matches := re.FindStringSubmatch(stdout.String())
if matches == nil {
return "", errors.New("IP not found in ifconfig output...")
Expand Down
9 changes: 2 additions & 7 deletions iso/step_type_boot_command.go
Expand Up @@ -42,12 +42,7 @@ func (s *stepTypeBootCommand) Run(state multistep.StateBag) multistep.StepAction
driver := state.Get("driver").(parallelscommon.Driver)

// Determine the host IP
var ipFinder HostIPFinder
if finder, ok := driver.(HostIPFinder); ok {
ipFinder = finder
} else {
ipFinder = &IfconfigIPFinder{Device: "vmnet8"}
}
ipFinder := &IfconfigIPFinder{Device: "en0"}

hostIp, err := ipFinder.HostIP()
if err != nil {
Expand All @@ -57,7 +52,7 @@ func (s *stepTypeBootCommand) Run(state multistep.StateBag) multistep.StepAction
return multistep.ActionHalt
}

log.Printf("Host IP for the Parallels machine: %s", hostIp)
ui.Say(fmt.Sprintf("Host IP for the Parallels machine: %s", hostIp))

tplData := &bootCommandTemplateData{
hostIp,
Expand Down

0 comments on commit f4f027c

Please sign in to comment.