core: ignore if box doesn't exist on update check [GH-3326]

This commit is contained in:
Mitchell Hashimoto 2014-04-02 08:24:14 -07:00
parent a3ed9cad20
commit 36ad327ec1
5 changed files with 9 additions and 15 deletions

View File

@ -22,6 +22,8 @@ BUG FIXES:
- core: Prerelease plugins installed are locked to that prerelease - core: Prerelease plugins installed are locked to that prerelease
version. [GH-3301] version. [GH-3301]
- core: Better error message when adding a box with a malformed version. [GH-3332] - core: Better error message when adding a box with a malformed version. [GH-3332]
- core: Fix a rare issue where vagrant up would complain it couldn't
check version of a box that doesn't exist. [GH-3326]
- commands/box: Show versions when listing. [GH-3316] - commands/box: Show versions when listing. [GH-3316]
- commands/status: Machine readable output contains the target. [GH-3218] - commands/status: Machine readable output contains the target. [GH-3218]
- guests/arch: Reload udev rules after network change. [GH-3322] - guests/arch: Reload udev rules after network change. [GH-3322]

View File

@ -23,10 +23,9 @@ module Vagrant
end end
if !machine.box if !machine.box
# The box doesn't exist. I suppose technically that means # We don't have a box. Just ignore, we can't check for
# that it is "outdated" but we show a specialized error # outdated...
# message anyways. return @app.call(env)
raise Errors::BoxOutdatedNoBox, name: machine.config.vm.box
end end
box = machine.box box = machine.box

View File

@ -184,10 +184,6 @@ module Vagrant
error_key(:box_not_found_with_provider) error_key(:box_not_found_with_provider)
end end
class BoxOutdatedNoBox < VagrantError
error_key(:box_outdated_no_box)
end
class BoxProviderDoesntMatch < VagrantError class BoxProviderDoesntMatch < VagrantError
error_key(:box_provider_doesnt_match) error_key(:box_provider_doesnt_match)
end end

View File

@ -407,10 +407,6 @@ en:
the box are shown below: the box are shown below:
%{providers} %{providers}
box_outdated_no_box: |-
The box '%{name}' isn't downloaded or added yet, so we can't
check if it is outdated. Run a `vagrant up` or add the box
with `vagrant box add` to download an appropriate version.
box_provider_doesnt_match: |- box_provider_doesnt_match: |-
The box you attempted to add doesn't match the provider you specified. The box you attempted to add doesn't match the provider you specified.

View File

@ -65,10 +65,11 @@ describe Vagrant::Action::Builtin::BoxCheckOutdated do
it "raises an exception if the machine doesn't have a box yet" do it "raises an exception if the machine doesn't have a box yet" do
machine.stub(box: nil) machine.stub(box: nil)
expect(app).to receive(:call).never expect(app).to receive(:call).with(env).once
expect { subject.call(env) }. subject.call(env)
to raise_error(Vagrant::Errors::BoxOutdatedNoBox)
expect(env).to_not have_key(:box_outdated)
end end
end end