Include plugin repair command
This commit is contained in:
parent
3fb5913af1
commit
5d68c8c30b
|
@ -27,6 +27,13 @@ module VagrantPlugins
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# This middleware sequence will repair installed plugins.
|
||||||
|
def self.action_repair
|
||||||
|
Vagrant::Action::Builder.new.tap do |b|
|
||||||
|
b.use RepairPlugins
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# This middleware sequence will uninstall a plugin.
|
# This middleware sequence will uninstall a plugin.
|
||||||
def self.action_uninstall
|
def self.action_uninstall
|
||||||
Vagrant::Action::Builder.new.tap do |b|
|
Vagrant::Action::Builder.new.tap do |b|
|
||||||
|
@ -48,6 +55,7 @@ module VagrantPlugins
|
||||||
autoload :LicensePlugin, action_root.join("license_plugin")
|
autoload :LicensePlugin, action_root.join("license_plugin")
|
||||||
autoload :ListPlugins, action_root.join("list_plugins")
|
autoload :ListPlugins, action_root.join("list_plugins")
|
||||||
autoload :PluginExistsCheck, action_root.join("plugin_exists_check")
|
autoload :PluginExistsCheck, action_root.join("plugin_exists_check")
|
||||||
|
autoload :RepairPlugins, action_root.join("repair_plugins")
|
||||||
autoload :UninstallPlugin, action_root.join("uninstall_plugin")
|
autoload :UninstallPlugin, action_root.join("uninstall_plugin")
|
||||||
autoload :UpdateGems, action_root.join("update_gems")
|
autoload :UpdateGems, action_root.join("update_gems")
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
require "vagrant/plugin/manager"
|
||||||
|
|
||||||
|
module VagrantPlugins
|
||||||
|
module CommandPlugin
|
||||||
|
module Action
|
||||||
|
# This middleware attempts to repair installed plugins.
|
||||||
|
#
|
||||||
|
# In general, if plugins are failing to properly load the
|
||||||
|
# core issue will likely be one of two issues:
|
||||||
|
# 1. manual modifications within ~/.vagrant.d/
|
||||||
|
# 2. vagrant upgrade
|
||||||
|
# Running an install on configured plugin set will most
|
||||||
|
# likely fix these issues, which is all this action does.
|
||||||
|
class RepairPlugins
|
||||||
|
def initialize(app, env)
|
||||||
|
@app = app
|
||||||
|
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"))
|
||||||
|
|
||||||
|
# Continue
|
||||||
|
@app.call(env)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,28 @@
|
||||||
|
require 'optparse'
|
||||||
|
|
||||||
|
require_relative "base"
|
||||||
|
|
||||||
|
module VagrantPlugins
|
||||||
|
module CommandPlugin
|
||||||
|
module Command
|
||||||
|
class Repair < Base
|
||||||
|
def execute
|
||||||
|
opts = OptionParser.new do |o|
|
||||||
|
o.banner = "Usage: vagrant plugin repair [-h]"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Parse the options
|
||||||
|
argv = parse_options(opts)
|
||||||
|
return if !argv
|
||||||
|
raise Vagrant::Errors::CLIInvalidUsage, help: opts.help.chomp if argv.length > 0
|
||||||
|
|
||||||
|
# Attempt to repair installed plugins
|
||||||
|
action(Action.action_repair)
|
||||||
|
|
||||||
|
# Success, exit status 0
|
||||||
|
0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -29,6 +29,11 @@ module VagrantPlugins
|
||||||
List
|
List
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@subcommands.register(:repair) do
|
||||||
|
require_relative "repair"
|
||||||
|
Repair
|
||||||
|
end
|
||||||
|
|
||||||
@subcommands.register(:update) do
|
@subcommands.register(:update) do
|
||||||
require_relative "update"
|
require_relative "update"
|
||||||
Update
|
Update
|
||||||
|
|
|
@ -1601,6 +1601,14 @@ en:
|
||||||
post_install: |-
|
post_install: |-
|
||||||
Post install message from the '%{name}' plugin:
|
Post install message from the '%{name}' plugin:
|
||||||
|
|
||||||
|
%{message}
|
||||||
|
repairing: |-
|
||||||
|
Repairing currently installed plugins. This may take a few minutes...
|
||||||
|
repair_complete: |-
|
||||||
|
Installed plugins successfully repaired!
|
||||||
|
repair_failed: |-
|
||||||
|
Failed to automatically repair installed Vagrant plugins. Failure message:
|
||||||
|
|
||||||
%{message}
|
%{message}
|
||||||
snapshot:
|
snapshot:
|
||||||
not_supported: |-
|
not_supported: |-
|
||||||
|
|
Loading…
Reference in New Issue