Multiple Chef provisioners no longer overwrite cookbook folders. [closes GH-407]
This commit is contained in:
parent
729d62d1ea
commit
e625dba5ab
|
@ -18,6 +18,7 @@
|
|||
`merge` technique. [GH-314]
|
||||
- Provisioner configuration is no longer cleared when the box
|
||||
needs to be downloaded during an `up`. [GH-308]
|
||||
- Multiple Chef provisioners no longer overwrite cookbook folders. [GH-407]
|
||||
|
||||
## 0.7.6 (July 2, 2011)
|
||||
|
||||
|
|
|
@ -76,6 +76,8 @@ module Vagrant
|
|||
class Chef < Base
|
||||
# This is the configuration which is available through `config.chef`
|
||||
class Config < Vagrant::Config::Base
|
||||
extend Util::Counter
|
||||
|
||||
# Shared config
|
||||
attr_accessor :node_name
|
||||
attr_accessor :provisioning_path
|
||||
|
@ -93,7 +95,7 @@ module Vagrant
|
|||
attr_accessor :run_list
|
||||
|
||||
def initialize
|
||||
@provisioning_path = "/tmp/vagrant-chef"
|
||||
@provisioning_path = "/tmp/vagrant-chef-#{self.class.get_and_update_counter}"
|
||||
@log_level = :info
|
||||
@json = {}
|
||||
@http_proxy = nil
|
||||
|
|
|
@ -4,8 +4,6 @@ module Vagrant
|
|||
class ChefSolo < Chef
|
||||
register :chef_solo
|
||||
|
||||
extend Util::Counter
|
||||
|
||||
class Config < Chef::Config
|
||||
attr_accessor :cookbooks_path
|
||||
attr_accessor :roles_path
|
||||
|
@ -58,6 +56,7 @@ module Vagrant
|
|||
# path element which contains the folder location (:host or :vm)
|
||||
paths = [paths] if paths.is_a?(String) || paths.first.is_a?(Symbol)
|
||||
|
||||
index = 0
|
||||
paths.map do |path|
|
||||
path = [:host, path] if !path.is_a?(Array)
|
||||
type, path = path
|
||||
|
@ -66,7 +65,8 @@ module Vagrant
|
|||
# or VM path.
|
||||
local_path = nil
|
||||
local_path = File.expand_path(path, env.root_path) if type == :host
|
||||
remote_path = type == :host ? "#{config.provisioning_path}/chef-solo-#{self.class.get_and_update_counter}" : path
|
||||
remote_path = type == :host ? "#{config.provisioning_path}/chef-solo-#{index}" : path
|
||||
index += 1
|
||||
|
||||
# Return the result
|
||||
[type, local_path, remote_path]
|
||||
|
@ -76,10 +76,12 @@ module Vagrant
|
|||
# Shares the given folders with the given prefix. The folders should
|
||||
# be of the structure resulting from the `expanded_folders` function.
|
||||
def share_folders(prefix, folders)
|
||||
index = 0
|
||||
folders.each do |type, local_path, remote_path|
|
||||
if type == :host
|
||||
env.config.vm.share_folder("v-#{prefix}-#{self.class.get_and_update_counter}",
|
||||
env.config.vm.share_folder("v-#{prefix}-#{index}",
|
||||
remote_path, local_path, :nfs => config.nfs)
|
||||
index += 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -52,7 +52,7 @@ class ChefSoloProvisionerTest < Test::Unit::TestCase
|
|||
should "expand host folders properly" do
|
||||
path = "foo"
|
||||
local_path = File.expand_path(path, @env.root_path)
|
||||
remote_path = "#{@action.config.provisioning_path}/chef-solo-1"
|
||||
remote_path = "#{@action.config.provisioning_path}/chef-solo-0"
|
||||
assert_equal [[:host, local_path, remote_path]], @action.expanded_folders([:host, path])
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue