provisioners/chef: support proper counter for multiple chefs

This commit is contained in:
Mitchell Hashimoto 2013-12-06 12:26:48 -08:00
parent 38f931ba93
commit f8223d4704
2 changed files with 10 additions and 9 deletions

View File

@ -1,7 +1,11 @@
require "vagrant/util/counter"
module VagrantPlugins module VagrantPlugins
module Chef module Chef
module Config module Config
class Base < Vagrant.plugin("2", :config) class Base < Vagrant.plugin("2", :config)
extend Vagrant::Util::Counter
attr_accessor :arguments attr_accessor :arguments
attr_accessor :attempts attr_accessor :attempts
attr_accessor :binary_path attr_accessor :binary_path
@ -74,6 +78,12 @@ module VagrantPlugins
# Make sure the log level is a symbol # Make sure the log level is a symbol
@log_level = @log_level.to_sym @log_level = @log_level.to_sym
# Set the default provisioning path to be a unique path in /tmp
if !@provisioning_path
counter = self.class.get_and_update_counter(:chef_config)
@provisioning_path = "/tmp/vagrant-chef-#{counter}"
end
end end
def merge(other) def merge(other)

View File

@ -1,6 +1,5 @@
require 'tempfile' require 'tempfile'
require "vagrant/util/counter"
require "vagrant/util/template_renderer" require "vagrant/util/template_renderer"
module VagrantPlugins module VagrantPlugins
@ -14,14 +13,6 @@ module VagrantPlugins
error_namespace("vagrant.provisioners.chef") error_namespace("vagrant.provisioners.chef")
end end
include Vagrant::Util::Counter
def initialize(machine, config)
super
config.provisioning_path ||= "/tmp/vagrant-chef-#{get_and_update_counter(:provisioning_path)}"
end
def verify_binary(binary) def verify_binary(binary)
# Checks for the existence of chef binary and error if it # Checks for the existence of chef binary and error if it
# doesn't exist. # doesn't exist.