Fix overzealous errors with chef solo provisioner defaults

This commit is contained in:
Mitchell Hashimoto 2013-03-18 11:23:53 -07:00
parent 5ad6c2a94a
commit 59282ba999
2 changed files with 14 additions and 6 deletions

View File

@ -1,6 +1,9 @@
## 1.1.2 (unreleased)
BUG FIXES:
- When not specifying a cookbooks_path for chef-solo, an error won't
be shown if "cookbooks" folder is missing.
## 1.1.1 (March 18, 2013)

View File

@ -22,11 +22,14 @@ module VagrantPlugins
@encrypted_data_bag_secret = UNSET_VALUE
@encrypted_data_bag_secret_key_path = UNSET_VALUE
@nfs = UNSET_VALUE
@__defaulted_cookbooks_path = false
end
def finalize!
if @cookbooks_path == UNSET_VALUE
@cookbooks_path = [[:host, "cookbooks"], [:vm, "cookbooks"]]
@__defaulted_cookbooks_path = true
end
@data_bags_path = [] if @data_bags_path == UNSET_VALUE
@ -52,13 +55,15 @@ module VagrantPlugins
errors << I18n.t("vagrant.config.chef.run_list_empty") if \
!run_list || run_list.empty?
@cookbooks_path.each do |type, path|
next if type != :host
expanded_path = File.expand_path(path, machine.env.root_path)
if !@__defaulted_cookbooks_path
@cookbooks_path.each do |type, path|
next if type != :host
expanded_path = File.expand_path(path, machine.env.root_path)
if !File.exist?(expanded_path)
errors << I18n.t("vagrant.config.chef.cookbooks_path_missing",
:path => expanded_path)
if !File.exist?(expanded_path)
errors << I18n.t("vagrant.config.chef.cookbooks_path_missing",
:path => expanded_path)
end
end
end