builder/virtualbox: detect vboxdrv issues [GH-488]

This commit is contained in:
Mitchell Hashimoto 2013-10-02 17:13:22 -07:00
parent c19fcafc01
commit 8821ef4def
2 changed files with 8 additions and 0 deletions

View File

@ -4,6 +4,7 @@ BUG FIXES:
* builder/all: timeout waiting for SSH connection is a failure. [GH-491]
* builder/virtualbox: error if VirtualBox version cant be detected. [GH-488]
* builder/virtualbox: detect if vboxdrv isn't properly setup. [GH-488]
## 0.3.9 (October 2, 2013)

View File

@ -136,6 +136,13 @@ func (d *VBox42Driver) Version() (string, error) {
versionOutput := strings.TrimSpace(stdout.String())
log.Printf("VBoxManage --version output: %s", versionOutput)
// If the "--version" output contains vboxdrv, then this is indicative
// of problems with the VirtualBox setup and we shouldn't really continue,
// whether or not we can read the version.
if strings.Contains(versionOutput, "vboxdrv") {
return "", fmt.Errorf("VirtualBox is not properly setup: %s", versionOutput)
}
versionRe := regexp.MustCompile("[^.0-9]")
matches := versionRe.Split(versionOutput, 2)
if len(matches) == 0 || matches[0] == "" {