Merge pull request #8041 from chrisroberts/ui/nicer-outputs
Logger and error outputs
This commit is contained in:
commit
3ec6290ad0
|
@ -264,6 +264,9 @@ if Vagrant.plugins_init?
|
||||||
Vagrant::Bundler.instance.init!(plugins)
|
Vagrant::Bundler.instance.init!(plugins)
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
global_logger.error("Plugin initialization error - #{e.class}: #{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
|
raise Vagrant::Errors::PluginInitError, message: e.to_s
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -330,6 +333,10 @@ if Vagrant.plugins_enabled?
|
||||||
::Bundler.require(:plugins)
|
::Bundler.require(:plugins)
|
||||||
end
|
end
|
||||||
rescue Exception => e
|
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
|
raise Vagrant::Errors::PluginLoadError, message: e.to_s
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -1647,7 +1647,13 @@ en:
|
||||||
repair_complete: |-
|
repair_complete: |-
|
||||||
Installed plugins successfully repaired!
|
Installed plugins successfully repaired!
|
||||||
repair_failed: |-
|
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}
|
%{message}
|
||||||
snapshot:
|
snapshot:
|
||||||
|
|
Loading…
Reference in New Issue