Module: VagrantPlugins::Cachier::Cap::Linux::ChefFileCachePath

Defined in:
lib/vagrant-cachier/cap/linux/chef_file_cache_path.rb

Class Method Summary collapse

Class Method Details

.chef_file_cache_path(machine) ⇒ Object



20
21
22
23
24
25
# File 'lib/vagrant-cachier/cap/linux/chef_file_cache_path.rb', line 20

def self.chef_file_cache_path(machine)
  chef_file_cache_path = nil
  chef_file_cache_path = '/var/chef/cache' if chef_provisioner?(machine)

  return chef_file_cache_path
end

.chef_provisioner?(machine) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/vagrant-cachier/cap/linux/chef_file_cache_path.rb', line 6

def self.chef_provisioner?(machine)
  provisioners = machine.config.vm.provisioners
  chef_provisioners = [:chef_solo, :chef_client]
  compat_provisioners = provisioners.keep_if { |p| chef_provisioners.include? p.name }

  if compat_provisioners.size > 1
    raise "One machine is using multiple chef provisioners, which is unsupported."
  end

  using_chef = compat_provisioners.empty? ? false : true

  using_chef
end