Allow other providers in WSL

This commit is contained in:
Stefan Scherer 2018-05-02 22:36:17 +02:00
parent 6fc2d9d82d
commit f14e8bcbf2
No known key found for this signature in database
GPG Key ID: 5966AEAC37E957FA
3 changed files with 12 additions and 15 deletions

View File

@ -844,10 +844,6 @@ module Vagrant
error_key(:vboxmanage_not_found_error)
end
class VBoxManageNotFoundWSLError < VagrantError
error_key(:vboxmanage_not_found_wsl_error)
end
class VirtualBoxBrokenVersion040214 < VagrantError
error_key(:virtualbox_broken_version_040214)
end

View File

@ -74,7 +74,18 @@ module VagrantPlugins
@logger.debug("Linux platform detected but executing within WSL. Locating VBoxManage.")
@vboxmanage_path = Vagrant::Util::Which.which("VBoxManage") || Vagrant::Util::Which.which("VBoxManage.exe")
if !@vboxmanage_path
raise Vagrant::Errors::VBoxManageNotFoundWSLError
# If we still don't have one, try to find it using common locations
drive = "/mnt/c"
[
"#{drive}/Program Files/Oracle/VirtualBox",
"#{drive}/Program Files (x86)/Oracle/VirtualBox"
].each do |maybe|
path = File.join(maybe, "VBoxManage.exe")
if File.file?(path)
@vboxmanage_path = path
break
end
end
end
end

View File

@ -1513,16 +1513,6 @@ en:
log out and log back in for the new environmental variables to take
effect. If you're on Linux or Mac, verify your PATH contains the folder
that has VBoxManage in it.
vboxmanage_not_found_wsl_error: |-
The "VBoxManage.exe" command or one of its dependencies could not
be found. Please verify VirtualBox is properly installed. You can verify
everything is okay by running "VBoxManage.exe --version" and verifying
that the VirtualBox version is outputted.
If you just installed VirtualBox, you have to log out and log back in for
the new environmental variables to take effect. Using the VirtualBox
provider within the WSL requires VirtualBox executables to be available
on the system PATH.
virtualbox_broken_version_040214: |-
Vagrant detected you have VirtualBox 4.2.14 installed. VirtualBox
4.2.14 contains a critical bug which prevents it from working with