Remove the chef dependency on the default 'v-root' shared folder.

This commit is contained in:
Justin Brown 2011-11-12 15:03:45 -05:00 committed by Mitchell Hashimoto
parent c48c7611b3
commit dcef64fa0d
2 changed files with 11 additions and 4 deletions

View File

@ -57,10 +57,10 @@ module Vagrant
env.ui.info I18n.t("vagrant.provisioners.chef.json") env.ui.info I18n.t("vagrant.provisioners.chef.json")
# Set up initial configuration # Set up initial configuration
data = { data, default_share = { :config => env.config.to_hash }, env.config.vm.shared_folders["v-root"]
:config => env.config.to_hash,
:directory => env.config.vm.shared_folders["v-root"][:guestpath], # Add the directory on the guest if the default shared folder exists
} data[:directory] = default_share[:guestpath] if default_share
# And wrap it under the "vagrant" namespace # And wrap it under the "vagrant" namespace
data = { :vagrant => data } data = { :vagrant => data }

View File

@ -186,6 +186,13 @@ class ChefProvisionerTest < Test::Unit::TestCase
end end
end end
should "not add the directory if the 'v-root' shared folder doesn't exist" do
@env.config.vm.shared_folders.delete("v-root")
assert_json do |data|
assert !data["vagrant"].has_key?("directory")
end
end
should "add the config to the JSON" do should "add the config to the JSON" do
assert_json do |data| assert_json do |data|
assert_equal @env.config.ssh.username, data["vagrant"]["config"]["ssh"]["username"] assert_equal @env.config.ssh.username, data["vagrant"]["config"]["ssh"]["username"]