providers/virtualbox: more descriptive error if empty version [GH-4657]
This commit is contained in:
parent
370ca050db
commit
37a4000722
|
@ -73,6 +73,8 @@ BUG FIXES:
|
|||
clean up an existing VM. [GH-4681]
|
||||
- providers/virtualbox: Detect case when VirtualBox reports 0.0.0.0 as
|
||||
IP address and don't allow it. [GH-4671]
|
||||
- providers/virtualbox: Show more descriptive error if VirtualBox is
|
||||
reporting an empty version. [GH-4657]
|
||||
- provisioners/docker: Get GPG key over SSL. [GH-4597]
|
||||
- provisioners/docker: Search for docker binary in multiple places. [GH-4580]
|
||||
- provisioners/salt: Highstate works properly with a master. [GH-4471]
|
||||
|
|
|
@ -736,6 +736,10 @@ module Vagrant
|
|||
error_key(:virtualbox_name_exists)
|
||||
end
|
||||
|
||||
class VirtualBoxVersionEmpty < VagrantError
|
||||
error_key(:virtualbox_version_empty)
|
||||
end
|
||||
|
||||
class VMBaseMacNotSpecified < VagrantError
|
||||
error_key(:no_base_mac, "vagrant.actions.vm.match_mac")
|
||||
end
|
||||
|
|
|
@ -2,6 +2,8 @@ require "forwardable"
|
|||
|
||||
require "log4r"
|
||||
|
||||
require "vagrant/util/retryable"
|
||||
|
||||
require File.expand_path("../base", __FILE__)
|
||||
|
||||
module VagrantPlugins
|
||||
|
@ -21,6 +23,8 @@ module VagrantPlugins
|
|||
# The version of virtualbox that is running.
|
||||
attr_reader :version
|
||||
|
||||
include Vagrant::Util::Retryable
|
||||
|
||||
def initialize(uuid=nil)
|
||||
# Setup the base
|
||||
super()
|
||||
|
@ -130,16 +134,24 @@ module VagrantPlugins
|
|||
|
||||
# Note: We split this into multiple lines because apparently "".split("_")
|
||||
# is [], so we have to check for an empty array in between.
|
||||
output = execute("--version")
|
||||
if output =~ /vboxdrv kernel module is not loaded/ ||
|
||||
output =~ /VirtualBox kernel modules are not loaded/i
|
||||
raise Vagrant::Errors::VirtualBoxKernelModuleNotLoaded
|
||||
elsif output =~ /Please install/
|
||||
# Check for installation incomplete warnings, for example:
|
||||
# "WARNING: The character device /dev/vboxdrv does not
|
||||
# exist. Please install the virtualbox-ose-dkms package and
|
||||
# the appropriate headers, most likely linux-headers-generic."
|
||||
raise Vagrant::Errors::VirtualBoxInstallIncomplete
|
||||
output = ""
|
||||
retryable(on: Vagrant::Errors::VirtualBoxVersionEmpty, tries: 3, sleep: 1) do
|
||||
output = execute("--version")
|
||||
if output =~ /vboxdrv kernel module is not loaded/ ||
|
||||
output =~ /VirtualBox kernel modules are not loaded/i
|
||||
raise Vagrant::Errors::VirtualBoxKernelModuleNotLoaded
|
||||
elsif output =~ /Please install/
|
||||
# Check for installation incomplete warnings, for example:
|
||||
# "WARNING: The character device /dev/vboxdrv does not
|
||||
# exist. Please install the virtualbox-ose-dkms package and
|
||||
# the appropriate headers, most likely linux-headers-generic."
|
||||
raise Vagrant::Errors::VirtualBoxInstallIncomplete
|
||||
elsif output.chomp == ""
|
||||
# This seems to happen on Windows for uncertain reasons.
|
||||
# Raise an error otherwise the error is that they have an
|
||||
# incompatible version of VirtualBox which isn't true.
|
||||
raise Vagrant::Errors::VirtualBoxVersionEmpty
|
||||
end
|
||||
end
|
||||
|
||||
parts = output.split("_")
|
||||
|
|
|
@ -1250,6 +1250,15 @@ en:
|
|||
Vagrant uses the `VBoxManage` binary that ships with VirtualBox, and requires
|
||||
this to be available on the PATH. If VirtualBox is installed, please find the
|
||||
`VBoxManage` binary and add it to the PATH environmental variable.
|
||||
virtualbox_version_empty: |-
|
||||
Vagrant detected that VirtualBox appears installed on your system,
|
||||
but calls to detect the version are returning empty. This is often
|
||||
indicative of installation issues with VirtualBox. Please verify
|
||||
that VirtualBox is properly installed. As a final verification,
|
||||
please run the following command manually and verify a version is
|
||||
outputted:
|
||||
|
||||
%{vboxmanage} --version
|
||||
vm_creation_required: |-
|
||||
VM must be created before running this command. Run `vagrant up` first.
|
||||
vm_inaccessible: |-
|
||||
|
|
Loading…
Reference in New Issue