core: outdated check checks local boxes [GH-3321]
This commit is contained in:
parent
36ad327ec1
commit
af7a589231
|
@ -25,6 +25,7 @@ BUG FIXES:
|
|||
- 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: Outdated check can list local boxes that are newer. [GH-3321]
|
||||
- commands/status: Machine readable output contains the target. [GH-3218]
|
||||
- guests/arch: Reload udev rules after network change. [GH-3322]
|
||||
- guests/debian: Changing host name works properly. [GH-3283]
|
||||
|
|
|
@ -54,6 +54,8 @@ module Vagrant
|
|||
name: update[0].name,
|
||||
current: box.version,
|
||||
latest: update[1].version))
|
||||
else
|
||||
check_outdated_local(env)
|
||||
end
|
||||
|
||||
@app.call(env)
|
||||
|
@ -61,9 +63,15 @@ module Vagrant
|
|||
|
||||
def check_outdated_local(env)
|
||||
machine = env[:machine]
|
||||
|
||||
# Make sure we respect the constraints set within the Vagrantfile
|
||||
version = machine.config.vm.box_version
|
||||
version += ", " if version
|
||||
version ||= ""
|
||||
version += "> #{machine.box.version}"
|
||||
|
||||
box = env[:box_collection].find(
|
||||
machine.box.name, machine.box.provider,
|
||||
"> #{machine.box.version}")
|
||||
machine.box.name, machine.box.provider, version)
|
||||
if box
|
||||
env[:ui].warn(I18n.t(
|
||||
"vagrant.box_outdated_local",
|
||||
|
|
|
@ -127,6 +127,32 @@ describe Vagrant::Action::Builtin::BoxCheckOutdated do
|
|||
expect(env[:box_outdated]).to be_true
|
||||
end
|
||||
|
||||
it "has an update if it is local" do
|
||||
iso_env.box3("foo", "1.1", :virtualbox)
|
||||
|
||||
expect(box).to receive(:has_update?).and_return(nil)
|
||||
|
||||
expect(app).to receive(:call).with(env).once
|
||||
|
||||
subject.call(env)
|
||||
|
||||
expect(env[:box_outdated]).to be_true
|
||||
end
|
||||
|
||||
it "does not have a local update if not within constraints" do
|
||||
iso_env.box3("foo", "1.1", :virtualbox)
|
||||
|
||||
machine.config.vm.box_version = "> 1.0, < 1.1"
|
||||
|
||||
expect(box).to receive(:has_update?).and_return(nil)
|
||||
|
||||
expect(app).to receive(:call).with(env).once
|
||||
|
||||
subject.call(env)
|
||||
|
||||
expect(env[:box_outdated]).to be_false
|
||||
end
|
||||
|
||||
it "raises error if has_update? errors" do
|
||||
expect(box).to receive(:has_update?).and_raise(Vagrant::Errors::VagrantError)
|
||||
|
||||
|
|
Loading…
Reference in New Issue