mirror of https://github.com/docker/docs.git
				
				
				
			Merge pull request #2550 from dgageot/2479-warn-vbox-version
FIX #2479 Warn on VirtualBox version
This commit is contained in:
		
						commit
						18372b13c3
					
				|  | @ -11,7 +11,9 @@ parent="smn_machine_drivers" | |||
| # Oracle VirtualBox | ||||
| 
 | ||||
| Create machines locally using [VirtualBox](https://www.virtualbox.org/). | ||||
| This driver requires VirtualBox 4+ to be installed on your host. | ||||
| This driver requires VirtualBox 5+ to be installed on your host. | ||||
| Using VirtualBox 4+ should work but will give you a warning. Older versions | ||||
| will refuse to work. | ||||
| 
 | ||||
|     $ docker-machine create --driver=virtualbox vbox-test | ||||
| 
 | ||||
|  |  | |||
|  | @ -79,7 +79,11 @@ func (v *VBoxCmdManager) vbmOutErr(args ...string) (string, string, error) { | |||
| 
 | ||||
| func checkVBoxManageVersion(version string) error { | ||||
| 	if !strings.HasPrefix(version, "5.") && !strings.HasPrefix(version, "4.") { | ||||
| 		return fmt.Errorf("We support Virtualbox starting with version 4. Your VirtualBox install is %q. Please upgrade at https://www.virtualbox.org", version) | ||||
| 		return fmt.Errorf("We support Virtualbox starting with version 5. Your VirtualBox install is %q. Please upgrade at https://www.virtualbox.org", version) | ||||
| 	} | ||||
| 
 | ||||
| 	if !strings.HasPrefix(version, "5.") { | ||||
| 		log.Warnf("You are using version %s of VirtualBox. If you encouter issues, you might want to upgrade to version 5 at https://www.virtualbox.org", version) | ||||
| 	} | ||||
| 
 | ||||
| 	return nil | ||||
|  |  | |||
|  | @ -30,8 +30,8 @@ func TestCheckVBoxManageVersionInvalid(t *testing.T) { | |||
| 		version       string | ||||
| 		expectedError string | ||||
| 	}{ | ||||
| 		{"3.9", `We support Virtualbox starting with version 4. Your VirtualBox install is "3.9". Please upgrade at https://www.virtualbox.org`}, | ||||
| 		{"", `We support Virtualbox starting with version 4. Your VirtualBox install is "". Please upgrade at https://www.virtualbox.org`}, | ||||
| 		{"3.9", `We support Virtualbox starting with version 5. Your VirtualBox install is "3.9". Please upgrade at https://www.virtualbox.org`}, | ||||
| 		{"", `We support Virtualbox starting with version 5. Your VirtualBox install is "". Please upgrade at https://www.virtualbox.org`}, | ||||
| 	} | ||||
| 
 | ||||
| 	for _, test := range tests { | ||||
|  |  | |||
|  | @ -204,7 +204,7 @@ func (d *Driver) PreCreateCheck() error { | |||
| 	} | ||||
| 
 | ||||
| 	// Check that VBoxManage is of a supported version
 | ||||
| 	if err = checkVBoxManageVersion(version); err != nil { | ||||
| 	if err = checkVBoxManageVersion(strings.TrimSpace(version)); err != nil { | ||||
| 		return err | ||||
| 	} | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue