From de6b55d00781c18516501c80cb280a058f430ea0 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 6 Jan 2015 10:48:31 -0800 Subject: [PATCH] provisioners/puppet: use predictable synced folders --- plugins/provisioners/puppet/config/puppet.rb | 13 +------------ plugins/provisioners/puppet/provisioner/puppet.rb | 10 +++++++--- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/plugins/provisioners/puppet/config/puppet.rb b/plugins/provisioners/puppet/config/puppet.rb index 3117f9f6f..1810b989b 100644 --- a/plugins/provisioners/puppet/config/puppet.rb +++ b/plugins/provisioners/puppet/config/puppet.rb @@ -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 diff --git a/plugins/provisioners/puppet/provisioner/puppet.rb b/plugins/provisioners/puppet/provisioner/puppet.rb index 62c32efa2..495340466 100644 --- a/plugins/provisioners/puppet/provisioner/puppet.rb +++ b/plugins/provisioners/puppet/provisioner/puppet.rb @@ -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]