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]
|
clean up an existing VM. [GH-4681]
|
||||||
- providers/virtualbox: Detect case when VirtualBox reports 0.0.0.0 as
|
- providers/virtualbox: Detect case when VirtualBox reports 0.0.0.0 as
|
||||||
IP address and don't allow it. [GH-4671]
|
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: Get GPG key over SSL. [GH-4597]
|
||||||
- provisioners/docker: Search for docker binary in multiple places. [GH-4580]
|
- provisioners/docker: Search for docker binary in multiple places. [GH-4580]
|
||||||
- provisioners/salt: Highstate works properly with a master. [GH-4471]
|
- provisioners/salt: Highstate works properly with a master. [GH-4471]
|
||||||
|
|
|
@ -736,6 +736,10 @@ module Vagrant
|
||||||
error_key(:virtualbox_name_exists)
|
error_key(:virtualbox_name_exists)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class VirtualBoxVersionEmpty < VagrantError
|
||||||
|
error_key(:virtualbox_version_empty)
|
||||||
|
end
|
||||||
|
|
||||||
class VMBaseMacNotSpecified < VagrantError
|
class VMBaseMacNotSpecified < VagrantError
|
||||||
error_key(:no_base_mac, "vagrant.actions.vm.match_mac")
|
error_key(:no_base_mac, "vagrant.actions.vm.match_mac")
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,6 +2,8 @@ require "forwardable"
|
||||||
|
|
||||||
require "log4r"
|
require "log4r"
|
||||||
|
|
||||||
|
require "vagrant/util/retryable"
|
||||||
|
|
||||||
require File.expand_path("../base", __FILE__)
|
require File.expand_path("../base", __FILE__)
|
||||||
|
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
|
@ -21,6 +23,8 @@ module VagrantPlugins
|
||||||
# The version of virtualbox that is running.
|
# The version of virtualbox that is running.
|
||||||
attr_reader :version
|
attr_reader :version
|
||||||
|
|
||||||
|
include Vagrant::Util::Retryable
|
||||||
|
|
||||||
def initialize(uuid=nil)
|
def initialize(uuid=nil)
|
||||||
# Setup the base
|
# Setup the base
|
||||||
super()
|
super()
|
||||||
|
@ -130,16 +134,24 @@ module VagrantPlugins
|
||||||
|
|
||||||
# Note: We split this into multiple lines because apparently "".split("_")
|
# Note: We split this into multiple lines because apparently "".split("_")
|
||||||
# is [], so we have to check for an empty array in between.
|
# is [], so we have to check for an empty array in between.
|
||||||
output = execute("--version")
|
output = ""
|
||||||
if output =~ /vboxdrv kernel module is not loaded/ ||
|
retryable(on: Vagrant::Errors::VirtualBoxVersionEmpty, tries: 3, sleep: 1) do
|
||||||
output =~ /VirtualBox kernel modules are not loaded/i
|
output = execute("--version")
|
||||||
raise Vagrant::Errors::VirtualBoxKernelModuleNotLoaded
|
if output =~ /vboxdrv kernel module is not loaded/ ||
|
||||||
elsif output =~ /Please install/
|
output =~ /VirtualBox kernel modules are not loaded/i
|
||||||
# Check for installation incomplete warnings, for example:
|
raise Vagrant::Errors::VirtualBoxKernelModuleNotLoaded
|
||||||
# "WARNING: The character device /dev/vboxdrv does not
|
elsif output =~ /Please install/
|
||||||
# exist. Please install the virtualbox-ose-dkms package and
|
# Check for installation incomplete warnings, for example:
|
||||||
# the appropriate headers, most likely linux-headers-generic."
|
# "WARNING: The character device /dev/vboxdrv does not
|
||||||
raise Vagrant::Errors::VirtualBoxInstallIncomplete
|
# 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
|
end
|
||||||
|
|
||||||
parts = output.split("_")
|
parts = output.split("_")
|
||||||
|
|
|
@ -1250,6 +1250,15 @@ en:
|
||||||
Vagrant uses the `VBoxManage` binary that ships with VirtualBox, and requires
|
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
|
this to be available on the PATH. If VirtualBox is installed, please find the
|
||||||
`VBoxManage` binary and add it to the PATH environmental variable.
|
`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_creation_required: |-
|
||||||
VM must be created before running this command. Run `vagrant up` first.
|
VM must be created before running this command. Run `vagrant up` first.
|
||||||
vm_inaccessible: |-
|
vm_inaccessible: |-
|
||||||
|
|
Loading…
Reference in New Issue