provisioners/puppet: use predictable synced folders

This commit is contained in:
Mitchell Hashimoto 2015-01-06 10:48:31 -08:00
parent 155516fb6c
commit de6b55d007
2 changed files with 8 additions and 15 deletions

View File

@ -1,11 +1,7 @@
require "vagrant/util/counter"
module VagrantPlugins
module Puppet
module Config
class Puppet < Vagrant.plugin("2", :config)
extend Vagrant::Util::Counter
attr_accessor :facter
attr_accessor :hiera_config_path
attr_accessor :manifest_file
@ -65,15 +61,8 @@ module VagrantPlugins
@manifest_file = "default.pp" if @manifest_file == UNSET_VALUE
@module_path = nil if @module_path == UNSET_VALUE
@synced_folder_type = nil if @synced_folder_type == UNSET_VALUE
@temp_dir = nil if @temp_dir == UNSET_VALUE
@temp_dir = "/tmp/vagrant-puppet" if @temp_dir == UNSET_VALUE
@working_directory = nil if @working_directory == UNSET_VALUE
# Set a default temp dir that has an increasing counter so
# that multiple Puppet definitions won't overwrite each other
if !@temp_dir
counter = self.class.get_and_update_counter(:puppet_config)
@temp_dir = "/tmp/vagrant-puppet-#{counter}"
end
end
# Returns the module paths as an array of paths expanded relative to the

View File

@ -1,3 +1,5 @@
require "digest/md5"
require "log4r"
module VagrantPlugins
@ -22,8 +24,9 @@ module VagrantPlugins
# Setup the module paths
@module_paths = []
@expanded_module_paths.each_with_index do |path, i|
@module_paths << [path, File.join(config.temp_dir, "modules-#{i}")]
@expanded_module_paths.each_with_index do |path, _|
key = Digest::MD5.hexdigest(path)
@module_paths << [path, File.join(config.temp_dir, "modules-#{key}")]
end
folder_opts = {}
@ -85,7 +88,8 @@ module VagrantPlugins
def manifests_guest_path
if config.manifests_path[0] == :host
# The path is on the host, so point to where it is shared
File.join(config.temp_dir, "manifests")
key = Digest::MD5.hexdigest(config.manifests_path[1])
File.join(config.temp_dir, "manifests-#{key}")
else
# The path is on the VM, so just point directly to it
config.manifests_path[1]