From c19fcafc01c74746cb0e74bcfc0a3d9364674b50 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 2 Oct 2013 17:11:42 -0700 Subject: [PATCH] builder/virtualbox: error if version can't be detected [GH-488] --- CHANGELOG.md | 1 + builder/virtualbox/driver.go | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f4460723..047716f20 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,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] ## 0.3.9 (October 2, 2013) diff --git a/builder/virtualbox/driver.go b/builder/virtualbox/driver.go index ebd775a45..86a1a3905 100644 --- a/builder/virtualbox/driver.go +++ b/builder/virtualbox/driver.go @@ -135,9 +135,10 @@ func (d *VBox42Driver) Version() (string, error) { versionOutput := strings.TrimSpace(stdout.String()) log.Printf("VBoxManage --version output: %s", versionOutput) + versionRe := regexp.MustCompile("[^.0-9]") matches := versionRe.Split(versionOutput, 2) - if len(matches) == 0 { + if len(matches) == 0 || matches[0] == "" { return "", fmt.Errorf("No version found: %s", versionOutput) }