provisioners/puppet: use predictable synced folders
This commit is contained in:
parent
155516fb6c
commit
de6b55d007
|
@ -1,11 +1,7 @@
|
||||||
require "vagrant/util/counter"
|
|
||||||
|
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module Puppet
|
module Puppet
|
||||||
module Config
|
module Config
|
||||||
class Puppet < Vagrant.plugin("2", :config)
|
class Puppet < Vagrant.plugin("2", :config)
|
||||||
extend Vagrant::Util::Counter
|
|
||||||
|
|
||||||
attr_accessor :facter
|
attr_accessor :facter
|
||||||
attr_accessor :hiera_config_path
|
attr_accessor :hiera_config_path
|
||||||
attr_accessor :manifest_file
|
attr_accessor :manifest_file
|
||||||
|
@ -65,15 +61,8 @@ module VagrantPlugins
|
||||||
@manifest_file = "default.pp" if @manifest_file == UNSET_VALUE
|
@manifest_file = "default.pp" if @manifest_file == UNSET_VALUE
|
||||||
@module_path = nil if @module_path == UNSET_VALUE
|
@module_path = nil if @module_path == UNSET_VALUE
|
||||||
@synced_folder_type = nil if @synced_folder_type == 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
|
@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
|
end
|
||||||
|
|
||||||
# Returns the module paths as an array of paths expanded relative to the
|
# Returns the module paths as an array of paths expanded relative to the
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
require "digest/md5"
|
||||||
|
|
||||||
require "log4r"
|
require "log4r"
|
||||||
|
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
|
@ -22,8 +24,9 @@ module VagrantPlugins
|
||||||
|
|
||||||
# Setup the module paths
|
# Setup the module paths
|
||||||
@module_paths = []
|
@module_paths = []
|
||||||
@expanded_module_paths.each_with_index do |path, i|
|
@expanded_module_paths.each_with_index do |path, _|
|
||||||
@module_paths << [path, File.join(config.temp_dir, "modules-#{i}")]
|
key = Digest::MD5.hexdigest(path)
|
||||||
|
@module_paths << [path, File.join(config.temp_dir, "modules-#{key}")]
|
||||||
end
|
end
|
||||||
|
|
||||||
folder_opts = {}
|
folder_opts = {}
|
||||||
|
@ -85,7 +88,8 @@ module VagrantPlugins
|
||||||
def manifests_guest_path
|
def manifests_guest_path
|
||||||
if config.manifests_path[0] == :host
|
if config.manifests_path[0] == :host
|
||||||
# The path is on the host, so point to where it is shared
|
# 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
|
else
|
||||||
# The path is on the VM, so just point directly to it
|
# The path is on the VM, so just point directly to it
|
||||||
config.manifests_path[1]
|
config.manifests_path[1]
|
||||||
|
|
Loading…
Reference in New Issue