providers/virtualbox: detect conflict in name [GH-4681]
This commit is contained in:
parent
2f529d47e7
commit
58f7310444
|
@ -1,3 +1,10 @@
|
|||
## 1.7.0 (unreleased)
|
||||
|
||||
BUG FIXES:
|
||||
|
||||
- providers/virtualbox: Show a human-friendly error if VirtualBox didn't
|
||||
clean up an existing VM. [GH-4681]
|
||||
|
||||
## 1.6.5 (September 4, 2014)
|
||||
|
||||
BUG FIXES:
|
||||
|
|
|
@ -728,6 +728,10 @@ module Vagrant
|
|||
error_key(:virtualbox_no_name)
|
||||
end
|
||||
|
||||
class VirtualBoxNameExists < VagrantError
|
||||
error_key(:virtualbox_name_exists)
|
||||
end
|
||||
|
||||
class VMBaseMacNotSpecified < VagrantError
|
||||
error_key(:no_base_mac, "vagrant.actions.vm.match_mac")
|
||||
end
|
||||
|
|
|
@ -475,6 +475,13 @@ module VagrantPlugins
|
|||
|
||||
def set_name(name)
|
||||
execute("modifyvm", @uuid, "--name", name, retryable: true)
|
||||
rescue Vagrant::Errors::VBoxManageError => e
|
||||
raise if !e.extra_data[:stderr].include?("VERR_ALREADY_EXISTS")
|
||||
|
||||
# We got VERR_ALREADY_EXISTS. This means that we're renaming to
|
||||
# a VM name that already exists. Raise a custom error.
|
||||
raise Vagrant::Errors::VirtualBoxNameExists,
|
||||
stderr: e.extra_data[:stderr]
|
||||
end
|
||||
|
||||
def share_folders(folders)
|
||||
|
|
|
@ -1193,6 +1193,18 @@ en:
|
|||
VirtualBox is complaining that the installation is incomplete. Please
|
||||
run `VBoxManage --version` to see the error message which should contain
|
||||
instructions on how to fix this error.
|
||||
virtualbox_name_exists: |-
|
||||
The name of your virtual machine couldn't be set because VirtualBox
|
||||
is reporting another VM with that name already exists. Most of the
|
||||
time, this is because of an error with VirtualBox not cleaning up
|
||||
properly. To fix this, verify that no VMs with that name do exist
|
||||
(by opening the VirtualBox GUI). If they don't, then look at the
|
||||
folder in the error message from VirtualBox below and remove it
|
||||
if there isn't any information you need in there.
|
||||
|
||||
VirtualBox error:
|
||||
|
||||
%{stderr}
|
||||
virtualbox_no_name: |-
|
||||
Vagrant was unable to determine the recommended name for your
|
||||
VirtualBox VM. This is usually an issue with VirtualBox. The output
|
||||
|
|
Loading…
Reference in New Issue