From 751b4da2c605abc0c65b88460d4987ce73207f2a Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 3 Feb 2014 11:39:03 +0100 Subject: [PATCH] core: if box is unversioned, check update does nothing --- lib/vagrant/action/builtin/box_check_outdated.rb | 5 +++++ .../action/builtin/box_check_outdated_test.rb | 12 ++++++++++++ 2 files changed, 17 insertions(+) diff --git a/lib/vagrant/action/builtin/box_check_outdated.rb b/lib/vagrant/action/builtin/box_check_outdated.rb index 9026d9737..944fb6246 100644 --- a/lib/vagrant/action/builtin/box_check_outdated.rb +++ b/lib/vagrant/action/builtin/box_check_outdated.rb @@ -28,7 +28,12 @@ module Vagrant # message anyways. raise Errors::BoxOutdatedNoBox, name: machine.config.vm.box end + box = machine.box + if box.version == "0" && !box.metadata_url + return @app.call(env) + end + constraints = machine.config.vm.box_version env[:ui].output(I18n.t( 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 1d6ecf921..32dcdac0e 100644 --- a/test/unit/vagrant/action/builtin/box_check_outdated_test.rb +++ b/test/unit/vagrant/action/builtin/box_check_outdated_test.rb @@ -72,6 +72,18 @@ describe Vagrant::Action::Builtin::BoxCheckOutdated do end end + context "with a non-versioned box" do + it "does nothing" do + box.stub(metadata_url: nil) + box.stub(version: "0") + + app.should_receive(:call).once + box.should_receive(:has_update?).never + + subject.call(env) + end + end + context "with a box" do it "sets env if no update" do box.should_receive(:has_update?).and_return(nil)