Merge pull request #10829 from briancain/box-update-continue

Continue updating environment boxes if metadata not found
This commit is contained in:
Brian Cain 2019-05-08 09:32:58 -07:00 committed by GitHub
commit 93497b8ca3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 1 deletions

View File

@ -128,7 +128,13 @@ module VagrantPlugins
if download_options[:insecure].nil?
download_options[:insecure] = machine.config.vm.box_download_insecure
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

View File

@ -405,6 +405,24 @@ describe VagrantPlugins::CommandBox::Command::Update do
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
let(:argv) { ["--force"].concat(download_options) }