builder/virtualbox: error if version can't be detected [GH-488]

This commit is contained in:
Mitchell Hashimoto 2013-10-02 17:11:42 -07:00
parent 2057ed1366
commit c897998ec9
2 changed files with 3 additions and 1 deletions

View File

@ -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)

View File

@ -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)
}