Sha256: 66ad8d67cbcea4fabed6e383f4c1e60ca980680e12f49259faa5dd854aaae891

Contents?: true

Size: 1.38 KB

Versions: 26

Compression:

Stored size: 1.38 KB

Contents

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
          @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
          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
      end
    end
  end
end

Version data entries

26 entries across 22 versions & 4 rubygems

Version Path
vagrant-unbundled-2.1.2.0 plugins/commands/plugin/action/repair_plugins.rb
vagrant-packet-0.1.2 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-04f7215b5e3f/plugins/commands/plugin/action/repair_plugins.rb
vagrant-packet-0.1.2 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-04f7215b5e3f/plugins/commands/plugin/action/repair_plugins.rb
vagrant-packet-0.1.2 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-04f7215b5e3f/plugins/commands/plugin/action/repair_plugins.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-04f7215b5e3f/plugins/commands/plugin/action/repair_plugins.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-04f7215b5e3f/plugins/commands/plugin/action/repair_plugins.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-04f7215b5e3f/plugins/commands/plugin/action/repair_plugins.rb
vagrant-unbundled-2.1.1.0 plugins/commands/plugin/action/repair_plugins.rb
vagrant-unbundled-2.0.4.0 plugins/commands/plugin/action/repair_plugins.rb
vagrant-unbundled-2.0.3.0 plugins/commands/plugin/action/repair_plugins.rb
vagrant-aws-detiber-0.7.2.pre.4 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-419afb4dcffe/plugins/commands/plugin/action/repair_plugins.rb
vagrant-aws-detiber-0.7.2.pre.3 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-419afb4dcffe/plugins/commands/plugin/action/repair_plugins.rb
vagrant-aws-detiber-0.7.2.pre.2 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-419afb4dcffe/plugins/commands/plugin/action/repair_plugins.rb
vagrant-unbundled-2.0.2.0 plugins/commands/plugin/action/repair_plugins.rb
vagrant-unbundled-2.0.1.0 plugins/commands/plugin/action/repair_plugins.rb
vagrant-aws-mkubenka-0.7.2.pre.22 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-f3fdbf414272/plugins/commands/plugin/action/repair_plugins.rb
vagrant-aws-mkubenka-0.7.2.pre.16 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-1ee58c40e3f5/plugins/commands/plugin/action/repair_plugins.rb
vagrant-unbundled-2.0.0.1 plugins/commands/plugin/action/repair_plugins.rb
vagrant-unbundled-1.9.8.1 plugins/commands/plugin/action/repair_plugins.rb
vagrant-unbundled-1.9.7.1 plugins/commands/plugin/action/repair_plugins.rb