Continue updating environment boxes if metadata not found
Prior to this commit, if a user ran a `vagrant box update` on their entire environment and one of the boxes did not have a metadata file, the rest of the boxes in the update would be skipped. This commit fixes that by ignoring those boxes and showng a warning, so that the rest of the boxes could check for updates.
This commit is contained in:
parent
c22a145c59
commit
e2d017b219
|
@ -128,7 +128,13 @@ module VagrantPlugins
|
||||||
if download_options[:insecure].nil?
|
if download_options[:insecure].nil?
|
||||||
download_options[:insecure] = machine.config.vm.box_download_insecure
|
download_options[:insecure] = machine.config.vm.box_download_insecure
|
||||||
end
|
end
|
||||||
box_update(box, version, machine.ui, download_options, force)
|
|
||||||
|
begin
|
||||||
|
box_update(box, version, machine.ui, download_options, force)
|
||||||
|
rescue Vagrant::Errors::BoxUpdateNoMetadata => e
|
||||||
|
machine.ui.warn(e)
|
||||||
|
next
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -405,6 +405,24 @@ describe VagrantPlugins::CommandBox::Command::Update do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "ignoring boxes with no metadata" do
|
||||||
|
before do
|
||||||
|
allow(subject).to receive(:with_target_vms) { |&block| block.call machine }
|
||||||
|
end
|
||||||
|
|
||||||
|
let(:box) do
|
||||||
|
box_dir = test_iso_env.box3("foo", "1.0", :virtualbox)
|
||||||
|
box = Vagrant::Box.new(
|
||||||
|
"foo", :virtualbox, "1.0", box_dir, metadata_url: "foo")
|
||||||
|
allow(box).to receive(:has_update?).and_raise(Vagrant::Errors::BoxUpdateNoMetadata, name: "foo")
|
||||||
|
box
|
||||||
|
end
|
||||||
|
|
||||||
|
it "continues to update the rest of the boxes in the environment" do
|
||||||
|
subject.execute
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context "force flag is specified on the command line" do
|
context "force flag is specified on the command line" do
|
||||||
let(:argv) { ["--force"].concat(download_options) }
|
let(:argv) { ["--force"].concat(download_options) }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue