Sha256: f97dba0ae4b26f210718c5fa3f38a98e15604ce33f32788ccda423110a4b2d7b

Contents?: true

Size: 887 Bytes

Versions: 5

Compression:

Stored size: 887 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
          end

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
vagrant-berkshelf-4.1.0 lib/vagrant-berkshelf/action/share.rb
vagrant-berkshelf-4.0.4 lib/vagrant-berkshelf/action/share.rb
vagrant-berkshelf-4.0.3 lib/vagrant-berkshelf/action/share.rb
vagrant-berkshelf-4.0.2 lib/vagrant-berkshelf/action/share.rb
vagrant-berkshelf-4.0.1 lib/vagrant-berkshelf/action/share.rb