Provide error information on plugin repair error.

Also includes original exception information within logger output.
This commit is contained in:
Chris Roberts 2016-11-22 17:54:44 -08:00
parent 0cba6bf535
commit b0a3cfa978
1 changed files with 11 additions and 3 deletions

View File

@ -14,14 +14,22 @@ module VagrantPlugins
class RepairPlugins class RepairPlugins
def initialize(app, env) def initialize(app, env)
@app = app @app = app
@logger = Log4r::Logger.new("vagrant::plugins::plugincommand::repair")
end end
def call(env) def call(env)
env[:ui].info(I18n.t("vagrant.commands.plugin.repairing")) env[:ui].info(I18n.t("vagrant.commands.plugin.repairing"))
plugins = Vagrant::Plugin::Manager.instance.installed_plugins plugins = Vagrant::Plugin::Manager.instance.installed_plugins
Vagrant::Bundler.instance.init!(plugins, :repair) begin
env[:ui].info(I18n.t("vagrant.commands.plugin.repair_complete")) 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 # Continue
@app.call(env) @app.call(env)
end end