provisioners/chef: support proper counter for multiple chefs
This commit is contained in:
parent
38f931ba93
commit
f8223d4704
|
@ -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)
|
||||||
|
|
|
@ -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.
|
||||||
|
|
Loading…
Reference in New Issue