From 475b65cb3b334ac4976dc0b44aa80686a7e4bcf4 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 2 Oct 2013 17:13:22 -0700 Subject: [PATCH] builder/virtualbox: detect vboxdrv issues [GH-488] --- CHANGELOG.md | 1 + builder/virtualbox/driver.go | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 047716f20..4cc95e4fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/builder/virtualbox/driver.go b/builder/virtualbox/driver.go index 86a1a3905..b4a5392da 100644 --- a/builder/virtualbox/driver.go +++ b/builder/virtualbox/driver.go @@ -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] == "" {