Sha256: baa5d7be42751b131370cf4980a29e4a55afb4b6c9d6ac75c739e2267cf1e179

Contents?: true

Size: 923 Bytes

Versions: 5

Compression:

Stored size: 923 Bytes

Contents

require_relative 'base'

module VagrantPlugins
  module Berkshelf
    module Action
      class Share < Base
        def call(env)
          if !berkshelf_enabled?(env)
            @logger.info "Berkshelf disabled, skipping"
            return @app.call(env)
          end

          if !chef_solo?(env) && !chef_zero?(env)
            @logger.info "Provisioner does not need a share"
            return @app.call(env)
          end

          env[:machine].ui.info "Sharing cookbooks with VM"

          list = provisioners(:chef_solo, env) + provisioners(:chef_zero, env)
          list.each do |chef|
            value = chef.config.send(:prepare_folders_config, env[:berkshelf].shelf)

            @logger.debug "Setting cookbooks_path = #{value.inspect}"
            chef.config.cookbooks_path = value + Array(chef.config.cookbooks_path)
          end

          @app.call(env)
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
vagrant-berkshelf-nochefdk-6.0.0 lib/vagrant-berkshelf/action/share.rb
vagrant-berkshelf-5.1.2 lib/vagrant-berkshelf/action/share.rb
vagrant-berkshelf-5.1.1 lib/vagrant-berkshelf/action/share.rb
vagrant-berkshelf-5.1.0 lib/vagrant-berkshelf/action/share.rb
vagrant-berkshelf-5.0.0 lib/vagrant-berkshelf/action/share.rb