diff --git a/CHANGELOG.md b/CHANGELOG.md index c487dcde8..b5983cc20 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,7 @@ BUG FIXES: - hosts/windows: RDP command works without crash. [GH-3962] - providers/docker: Port on its own will choose random host port. [GH-3991] - providers/virtualbox: Increase network device limit to 36. [GH-4206] + - providers/virtualbox: Error if can't detect VM name. [GH-4047] - provisioners/chef: Chef client cleanup should work. [GH-4099] - provisioners/puppet: Manifest file can be a directory. [GH-4169] - provisioners/puppet: Properly escape facter variables for PowerShell diff --git a/plugins/providers/virtualbox/driver/version_4_3.rb b/plugins/providers/virtualbox/driver/version_4_3.rb index 14d12704a..cc700c0fa 100644 --- a/plugins/providers/virtualbox/driver/version_4_3.rb +++ b/plugins/providers/virtualbox/driver/version_4_3.rb @@ -171,6 +171,9 @@ module VagrantPlugins @logger.debug("Doing dry-run import to determine parallel-safe name...") output = execute("import", "-n", ovf) result = /Suggested VM name "(.+?)"/.match(output) + if !result + raise Vagrant::Errors::VirtualBoxNoName, output: output + end suggested_name = result[1].to_s # Append millisecond plus a random to the path in case we're @@ -199,7 +202,7 @@ module VagrantPlugins # specified_name were "abc123", then "\\abc123\\".reverse would be "\\321cba\\", and the \3 would be treated as a back reference by the sub disk_params << path.reverse.sub("\\#{suggested_name}\\".reverse) { "\\#{specified_name}\\".reverse }.reverse # Replace only last occurrence else - disk_params << path.reverse.sub("/#{suggested_name}/".reverse, "/#{specified_name}/".reverse).reverse # Replace only last occurrence + disk_params << path.reverse.sub("/#{suggested_name}/".reverse, "/#{specified_name}/".reverse).reverse # Replace only last occurrence end end diff --git a/templates/locales/en.yml b/templates/locales/en.yml index 276cdc41f..5b57d99b9 100644 --- a/templates/locales/en.yml +++ b/templates/locales/en.yml @@ -1166,6 +1166,16 @@ 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_no_name: |- + Vagrant was unable to determine the recommended name for your + VirtualBox VM. This is usually an issue with VirtualBox. The output + from VirtualBox is shown below, which may contain an error to fix. + The best way to fix this issue is usually to uninstall VirtualBox, + restart your computer, then reinstall VirtualBox. + + VirtualBox output: + + %{output} virtualbox_no_room_for_high_level_network: |- There is no available slots on the VirtualBox VM for the configured high-level network interfaces. "private_network" and "public_network"