Merge pull request #9760 from briancain/continue-on-malformed-json
Continue on if vagrant fails to parse metadata box for update
This commit is contained in:
commit
70df6d4b2a
|
@ -58,6 +58,9 @@ module Vagrant
|
|||
env[:ui].warn(I18n.t(
|
||||
"vagrant.box_outdated_metadata_download_error",
|
||||
message: e.extra_data[:message]))
|
||||
rescue Errors::BoxMetadataMalformed => e
|
||||
@logger.warn(e.to_s)
|
||||
env[:ui].warn(I18n.t("vagrant.box_malformed_continue_on_update"))
|
||||
rescue Errors::VagrantError => e
|
||||
raise if !env[:box_outdated_ignore_errors]
|
||||
env[:ui].detail(I18n.t(
|
||||
|
|
|
@ -40,6 +40,9 @@ en:
|
|||
URL: %{url}
|
||||
box_loading_metadata: |-
|
||||
Loading metadata for box '%{name}'
|
||||
box_malformed_continue_on_update: |-
|
||||
Could not determine box updates because box metadata was malformed.
|
||||
Vagrant will continue on...
|
||||
box_outdated: |-
|
||||
* '%{name}' for '%{provider}' is outdated! Current: %{current}. Latest: %{latest}
|
||||
box_outdated_checking_with_refresh: |-
|
||||
|
|
|
@ -166,6 +166,17 @@ describe Vagrant::Action::Builtin::BoxCheckOutdated do
|
|||
expect(env[:box_outdated]).to be(false)
|
||||
end
|
||||
|
||||
it "does nothing if metadata cannot be parsed" do
|
||||
expect(box).to receive(:has_update?).and_raise(
|
||||
Vagrant::Errors::BoxMetadataMalformed.new(error: "Whoopsie"))
|
||||
|
||||
expect(app).to receive(:call).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