Sha256: 6a99c791a5353823779b548ef9318a24f1aac481c89e05c52a62e0a7f369d126

Contents?: true

Size: 1.36 KB

Versions: 3

Compression:

Stored size: 1.36 KB

Contents

module Berkshelf
  module Vagrant
    # @author Jamie Winsor <reset@riotgames.com>
    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)
          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_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

3 entries across 3 versions & 1 rubygems

Version Path
berkshelf-vagrant-1.1.2 lib/berkshelf/vagrant/plugin.rb
berkshelf-vagrant-1.1.0 lib/berkshelf/vagrant/plugin.rb
berkshelf-vagrant-1.0.6 lib/berkshelf/vagrant/plugin.rb