diff --git a/CHANGELOG.md b/CHANGELOG.md index 71641293e..bc2bfa56f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,8 @@ BUG FIXES: - core: Prerelease plugins installed are locked to that prerelease version. [GH-3301] - 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/status: Machine readable output contains the target. [GH-3218] - guests/arch: Reload udev rules after network change. [GH-3322] diff --git a/lib/vagrant/action/builtin/box_check_outdated.rb b/lib/vagrant/action/builtin/box_check_outdated.rb index 944fb6246..fcd88c384 100644 --- a/lib/vagrant/action/builtin/box_check_outdated.rb +++ b/lib/vagrant/action/builtin/box_check_outdated.rb @@ -23,10 +23,9 @@ module Vagrant end if !machine.box - # The box doesn't exist. I suppose technically that means - # that it is "outdated" but we show a specialized error - # message anyways. - raise Errors::BoxOutdatedNoBox, name: machine.config.vm.box + # We don't have a box. Just ignore, we can't check for + # outdated... + return @app.call(env) end box = machine.box diff --git a/lib/vagrant/errors.rb b/lib/vagrant/errors.rb index 03c6578fa..a886560ca 100644 --- a/lib/vagrant/errors.rb +++ b/lib/vagrant/errors.rb @@ -184,10 +184,6 @@ module Vagrant error_key(:box_not_found_with_provider) end - class BoxOutdatedNoBox < VagrantError - error_key(:box_outdated_no_box) - end - class BoxProviderDoesntMatch < VagrantError error_key(:box_provider_doesnt_match) end diff --git a/templates/locales/en.yml b/templates/locales/en.yml index bcf2b24d1..b4017f3b3 100644 --- a/templates/locales/en.yml +++ b/templates/locales/en.yml @@ -407,10 +407,6 @@ en: the box are shown below: %{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: |- The box you attempted to add doesn't match the provider you specified. diff --git a/test/unit/vagrant/action/builtin/box_check_outdated_test.rb b/test/unit/vagrant/action/builtin/box_check_outdated_test.rb index 0bb133549..9e1a2051e 100644 --- a/test/unit/vagrant/action/builtin/box_check_outdated_test.rb +++ b/test/unit/vagrant/action/builtin/box_check_outdated_test.rb @@ -65,10 +65,11 @@ describe Vagrant::Action::Builtin::BoxCheckOutdated do it "raises an exception if the machine doesn't have a box yet" do machine.stub(box: nil) - expect(app).to receive(:call).never + expect(app).to receive(:call).with(env).once - expect { subject.call(env) }. - to raise_error(Vagrant::Errors::BoxOutdatedNoBox) + subject.call(env) + + expect(env).to_not have_key(:box_outdated) end end