From d87cf25ed26310a1e7db5798daf16c4fc21b7e95 Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Tue, 22 Nov 2016 17:54:02 -0800 Subject: [PATCH 1/3] Display original exception and backtraces in logger output --- lib/vagrant.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/vagrant.rb b/lib/vagrant.rb index e2603026e..3db8f0897 100644 --- a/lib/vagrant.rb +++ b/lib/vagrant.rb @@ -264,6 +264,9 @@ if Vagrant.plugins_init? Vagrant::Bundler.instance.init!(plugins) rescue Exception => e global_logger.error("Plugin initialization error - #{e.class}: #{e}") + e.backtrace.each do |backtrace_line| + global_logger.debug(backtrace_line) + end raise Vagrant::Errors::PluginInitError, message: e.to_s end end @@ -330,6 +333,10 @@ if Vagrant.plugins_enabled? ::Bundler.require(:plugins) end rescue Exception => e + global_logger.error("Plugin loading error: #{e.class} - #{e}") + e.backtrace.each do |backtrace_line| + global_logger.debug(backtrace_line) + end raise Vagrant::Errors::PluginLoadError, message: e.to_s end end From 0cba6bf535b9dcddbb5dd8e10cf735e8a313da59 Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Tue, 22 Nov 2016 17:54:28 -0800 Subject: [PATCH 2/3] Expand on plugin repair failure output --- templates/locales/en.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/templates/locales/en.yml b/templates/locales/en.yml index 6523fd0ad..1dc166863 100644 --- a/templates/locales/en.yml +++ b/templates/locales/en.yml @@ -1647,7 +1647,13 @@ en: repair_complete: |- Installed plugins successfully repaired! repair_failed: |- - Failed to automatically repair installed Vagrant plugins. Failure message: + Failed to automatically repair installed Vagrant plugins. To fix this + problem remove all user installed plugins and reinstall. Vagrant can + do this for you automatically by running the following command: + + vagrant plugin expunge --reinstall + + Failure message received during repair: %{message} snapshot: From b0a3cfa978d095c19e8703a8ad5d796bfef7c2c1 Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Tue, 22 Nov 2016 17:54:44 -0800 Subject: [PATCH 3/3] Provide error information on plugin repair error. Also includes original exception information within logger output. --- plugins/commands/plugin/action/repair_plugins.rb | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/plugins/commands/plugin/action/repair_plugins.rb b/plugins/commands/plugin/action/repair_plugins.rb index 3ce886b3f..9745d378b 100644 --- a/plugins/commands/plugin/action/repair_plugins.rb +++ b/plugins/commands/plugin/action/repair_plugins.rb @@ -14,14 +14,22 @@ module VagrantPlugins class RepairPlugins def initialize(app, env) @app = app + @logger = Log4r::Logger.new("vagrant::plugins::plugincommand::repair") end def call(env) env[:ui].info(I18n.t("vagrant.commands.plugin.repairing")) plugins = Vagrant::Plugin::Manager.instance.installed_plugins - Vagrant::Bundler.instance.init!(plugins, :repair) - env[:ui].info(I18n.t("vagrant.commands.plugin.repair_complete")) - + begin + Vagrant::Bundler.instance.init!(plugins, :repair) + env[:ui].info(I18n.t("vagrant.commands.plugin.repair_complete")) + rescue Exception => e + @logger.error("Failed to repair user installed plugins: #{e.class} - #{e}") + e.backtrace.each do |backtrace_line| + @logger.debug(backtrace_line) + end + env[:ui].error(I18n.t("vagrant.commands.plugin.repair_failed", message: e.message)) + end # Continue @app.call(env) end