Error message when kernel module is not loaded for VirtualBox [GH-677]

This commit is contained in:
Mitchell Hashimoto 2012-01-24 19:30:55 -08:00
parent f48a2784a0
commit ce2ea4ea93
4 changed files with 16 additions and 1 deletions

View File

@ -1,6 +1,7 @@
## 0.9.4 (unreleased)
- Match VM names that have parens, brackets, etc.
- Detect when the VirtualBox kernel module is not loaded and error. [GH-677]
## 0.9.3 (January 24, 2012)

View File

@ -117,7 +117,12 @@ module Vagrant
# Note: We split this into multiple lines because apparently "".split("_")
# is [], so we have to check for an empty array in between.
parts = execute("--version").split("_")
output = execute("--version")
if output =~ /vboxdrv kernel module is not loaded/
raise Errors::VirtualBoxKernelModuleNotLoaded
end
parts = output.split("_")
return nil if parts.empty?
parts[0].split("r")[0]
end

View File

@ -343,6 +343,11 @@ module Vagrant
error_key(:virtualbox_not_detected)
end
class VirtualBoxKernelModuleNotLoaded < VagrantError
status_code(70)
error_key(:virtualbox_kernel_module_not_loaded)
end
class VMBaseMacNotSpecified < VagrantError
status_code(47)
error_key(:no_base_mac, "vagrant.actions.vm.match_mac")

View File

@ -166,6 +166,10 @@ en:
listed below to use Vagrant:
%{supported_versions}
virtualbox_kernel_module_not_loaded: |-
VirtualBox is complaining that the kernel module is not loaded. Please
run `VBoxManage --version` to see the error message which should contain
instructions on how to fix this error.
virtualbox_not_detected: |-
Vagrant could not detect VirtualBox! Make sure VirtualBox is properly installed.
Vagrant uses the `VBoxManage` binary that ships with VirtualBox, and requires