core: error earlier if adding a path that doesn't exist
This commit is contained in:
parent
b0f8d050f0
commit
8634cc309b
|
@ -18,6 +18,7 @@ BUG FIXES:
|
|||
- core: Adding a box by path in Cygwin on Windos works. [GH-3132]
|
||||
- core: PowerShell scripts work when they're in a directory with
|
||||
spaces. [GH-3100]
|
||||
- core: If you add a box path that doesn't exist, error earlier. [GH-3091]
|
||||
- guests/darwin: Fix an exception when configuring networks. [GH-3143]
|
||||
- hosts/linux: Unusual sed delimiter to avoid conflicts. [GH-3167]
|
||||
- providers/virtualbox: Make more internal interactions with VBoxManage
|
||||
|
|
|
@ -314,6 +314,9 @@ module Vagrant
|
|||
box_url = download(url, env, show_url: show_url)
|
||||
break
|
||||
rescue Errors::DownloaderError => e
|
||||
# If we don't have multiple URLs, just raise the error
|
||||
raise if urls.length == 1
|
||||
|
||||
env[:ui].error(I18n.t(
|
||||
"vagrant.box_download_error", message: e.message))
|
||||
box_url = nil
|
||||
|
|
|
@ -164,6 +164,19 @@ describe Vagrant::Action::Builtin::BoxAdd do
|
|||
to raise_error(Vagrant::Errors::BoxChecksumMismatch)
|
||||
end
|
||||
|
||||
it "raises an error if the box path doesn't exist" do
|
||||
box_path = iso_env.box2_file(:virtualbox)
|
||||
|
||||
env[:box_name] = "foo"
|
||||
env[:box_url] = box_path.to_s + "nope"
|
||||
|
||||
box_collection.should_receive(:add).never
|
||||
app.should_receive(:call).never
|
||||
|
||||
expect { subject.call(env) }.
|
||||
to raise_error(Vagrant::Errors::DownloaderError)
|
||||
end
|
||||
|
||||
it "force adds if exists and specified" do
|
||||
box_path = iso_env.box2_file(:virtualbox)
|
||||
|
||||
|
|
Loading…
Reference in New Issue