Provide nice error output when plugin initialization fails
Include extra logging during initialization to display error if encountered and solution set prior to performing activations.
This commit is contained in:
parent
2e1511e2ea
commit
e2d96f942f
|
@ -254,23 +254,9 @@ end
|
||||||
if Vagrant.plugins_init?
|
if Vagrant.plugins_init?
|
||||||
begin
|
begin
|
||||||
Vagrant::Bundler.instance.init!(plugins)
|
Vagrant::Bundler.instance.init!(plugins)
|
||||||
rescue Gem::ConflictError, Gem::DependencyError => e
|
rescue Exception => e
|
||||||
$stderr.puts "Vagrant experienced a version conflict with some installed plugins!"
|
global_logger.error("Plugin initialization error - #{e.class}: #{e}")
|
||||||
$stderr.puts "This usually happens if you recently upgraded Vagrant. As part of the"
|
raise Vagrant::Errors::PluginInitError, message: e.to_s
|
||||||
$stderr.puts "upgrade process, some existing plugins are no longer compatible with"
|
|
||||||
$stderr.puts "this version of Vagrant. The recommended way to fix this is to remove"
|
|
||||||
$stderr.puts "your existing plugins and reinstall them one-by-one. To remove all"
|
|
||||||
$stderr.puts "plugins:"
|
|
||||||
$stderr.puts ""
|
|
||||||
$stderr.puts " vagrant expunge"
|
|
||||||
$stderr.puts ""
|
|
||||||
$stderr.puts "Note if you have an alternate VAGRANT_HOME environmental variable"
|
|
||||||
$stderr.puts "set, the folders above will be in that directory rather than your"
|
|
||||||
$stderr.puts "user's home directory."
|
|
||||||
$stderr.puts ""
|
|
||||||
$stderr.puts "The error message is shown below:\n\n"
|
|
||||||
$stderr.puts e.message
|
|
||||||
exit 1
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -92,11 +92,10 @@ module Vagrant
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@logger.debug("Initialization solution set: #{solution.map(&:full_name)}")
|
|
||||||
|
|
||||||
# Activate the gems
|
# Activate the gems
|
||||||
|
retried = false
|
||||||
begin
|
begin
|
||||||
retried = false
|
@logger.debug("Initialization solution set: #{solution.map(&:full_name)}")
|
||||||
solution.each do |activation_request|
|
solution.each do |activation_request|
|
||||||
unless activation_request.full_spec.activated?
|
unless activation_request.full_spec.activated?
|
||||||
@logger.debug("Activating gem #{activation_request.full_spec.full_name}")
|
@logger.debug("Activating gem #{activation_request.full_spec.full_name}")
|
||||||
|
@ -107,14 +106,16 @@ module Vagrant
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
rescue Gem::LoadError
|
rescue Gem::LoadError => e
|
||||||
# Depending on the version of Ruby, the ordering of the solution set
|
# Depending on the version of Ruby, the ordering of the solution set
|
||||||
# will be either 0..n (molinillo) or n..0 (pre-molinillo). Instead of
|
# will be either 0..n (molinillo) or n..0 (pre-molinillo). Instead of
|
||||||
# attempting to determine what's in use, or if it has some how changed
|
# attempting to determine what's in use, or if it has some how changed
|
||||||
# again, just reverse order on failure and attempt again.
|
# again, just reverse order on failure and attempt again.
|
||||||
if retried
|
if retried
|
||||||
|
@logger.error("Failed to load solution set - #{e.class}: #{e}")
|
||||||
raise
|
raise
|
||||||
else
|
else
|
||||||
|
@logger.debug("Failed to load solution set. Retrying with reverse order.")
|
||||||
retried = true
|
retried = true
|
||||||
solution.reverse!
|
solution.reverse!
|
||||||
retry
|
retry
|
||||||
|
|
|
@ -982,6 +982,15 @@ en:
|
||||||
by contacting a plugin author to see if they can address the conflict.
|
by contacting a plugin author to see if they can address the conflict.
|
||||||
|
|
||||||
%{conflicts}
|
%{conflicts}
|
||||||
|
plugin_init_error: |-
|
||||||
|
The plugins failed to initialize correctly. If Vagrant was recently
|
||||||
|
updated, this error may be due to incompatible versions of dependencies.
|
||||||
|
To fix this problem please remove and re-install all plugins. Vagrant can
|
||||||
|
attempt to do this automatically by running:
|
||||||
|
|
||||||
|
vagrant plugin expunge --reinstall
|
||||||
|
|
||||||
|
Error message given during initialization: %{message}
|
||||||
plugin_load_error: |-
|
plugin_load_error: |-
|
||||||
The plugins failed to load properly. The error message given is
|
The plugins failed to load properly. The error message given is
|
||||||
shown below.
|
shown below.
|
||||||
|
|
Loading…
Reference in New Issue