Commit 83772fc5 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

Merge pull request #1509 from kamazee/fix_detecting_guest_additions_when_sysprop_empty

Fix detecting guest additions URL
parents 2d71bebe 3592d670
...@@ -49,11 +49,12 @@ func (d *VBox42Driver) Iso() (string, error) { ...@@ -49,11 +49,12 @@ func (d *VBox42Driver) Iso() (string, error) {
return "", err return "", err
} }
DefaultGuestAdditionsRe := regexp.MustCompile("Default Guest Additions ISO:(.*)") DefaultGuestAdditionsRe := regexp.MustCompile("Default Guest Additions ISO:(.+)")
for _, line := range strings.Split(stdout.String(), "\n") { for _, line := range strings.Split(stdout.String(), "\n") {
// Need to trim off CR character when running in windows // Need to trim off CR character when running in windows
line = strings.TrimRight(line, "\r") // Trimming whitespaces at this point helps to filter out empty value
line = strings.TrimRight(line, " \r")
matches := DefaultGuestAdditionsRe.FindStringSubmatch(line) matches := DefaultGuestAdditionsRe.FindStringSubmatch(line)
if matches == nil { if matches == nil {
...@@ -66,7 +67,7 @@ func (d *VBox42Driver) Iso() (string, error) { ...@@ -66,7 +67,7 @@ func (d *VBox42Driver) Iso() (string, error) {
return isoname, nil return isoname, nil
} }
return "", fmt.Errorf("Cannot find \"Default Guest Additions ISO\" in vboxmanage output") return "", fmt.Errorf("Cannot find \"Default Guest Additions ISO\" in vboxmanage output (or it is empty)")
} }
func (d *VBox42Driver) Import(name string, path string, flags []string) error { func (d *VBox42Driver) Import(name string, path string, flags []string) error {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment