Sha256: eaa2fffb1105072a644723d40a9c5d441821b40e9097506d7726ae2822f941dc

Contents?: true

Size: 1.75 KB

Versions: 14

Compression:

Stored size: 1.75 KB

Contents

module Berkshelf
  module Vagrant
    class Plugin < ::Vagrant.plugin("2")
      class << self
        def provision(hook)
          hook.after(::Vagrant::Action::Builtin::Provision, Berkshelf::Vagrant::Action.upload)
          hook.after(::Vagrant::Action::Builtin::Provision, Berkshelf::Vagrant::Action.install)

          # vagrant-aws < 0.4.0 uses a non-standard provision action
          if defined?(VagrantPlugins::AWS::Action::TimedProvision)
            hook.after(VagrantPlugins::AWS::Action::TimedProvision, Berkshelf::Vagrant::Action.upload)
            hook.after(VagrantPlugins::AWS::Action::TimedProvision, Berkshelf::Vagrant::Action.install)
          end

          hook.before(::Vagrant::Action::Builtin::ConfigValidate, Berkshelf::Vagrant::Action.setup)
        end
      end

      name "berkshelf"
      description <<-DESC
      Automatically make available cookbooks to virtual machines provisioned by Chef Solo
      or Chef Client using Berkshelf.
      DESC

      action_hook(:berkshelf_provision, :machine_action_up, &method(:provision))
      action_hook(:berkshelf_provision, :machine_action_reload, &method(:provision))
      action_hook(:berkshelf_provision, :machine_action_provision, &method(:provision))

      action_hook(:berkshelf_cleanup, :machine_action_destroy) do |hook|
        # @todo this should be appended to the middleware stack instead of hooked in after the
        #   Virtualbox specific destroy step but there is a bug in Vagrant (1.1.0) which
        #   causes appended middleware to run multiple times.
        hook.after(VagrantPlugins::ProviderVirtualBox::Action::DestroyUnusedNetworkInterfaces, Berkshelf::Vagrant::Action.clean)
      end

      config(:berkshelf) do
        Berkshelf::Vagrant::Config
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
vagrant-berkshelf-3.0.1 lib/berkshelf/vagrant/plugin.rb
vagrant-berkshelf-3.0.0 lib/berkshelf/vagrant/plugin.rb
vagrant-berkshelf-3.0.0.rc2 lib/berkshelf/vagrant/plugin.rb
vagrant-berkshelf-3.0.0.rc1 lib/berkshelf/vagrant/plugin.rb
vagrant-berkshelf-2.0.1 lib/berkshelf/vagrant/plugin.rb
vagrant-berkshelf-2.0.0.rc4 lib/berkshelf/vagrant/plugin.rb
vagrant-berkshelf-2.0.0.rc3 lib/berkshelf/vagrant/plugin.rb
vagrant-berkshelf-2.0.0.rc2 lib/berkshelf/vagrant/plugin.rb
vagrant-berkshelf-2.0.0.rc1 lib/berkshelf/vagrant/plugin.rb
vagrant-berkshelf-1.3.7 lib/berkshelf/vagrant/plugin.rb
vagrant-berkshelf-1.3.6 lib/berkshelf/vagrant/plugin.rb
vagrant-berkshelf-1.3.5 lib/berkshelf/vagrant/plugin.rb
vagrant-berkshelf-1.4.0.dev1 lib/berkshelf/vagrant/plugin.rb
vagrant-berkshelf-1.3.4 lib/berkshelf/vagrant/plugin.rb