diff --git a/lib/vagrant/provisioners/chef_solo.rb b/lib/vagrant/provisioners/chef_solo.rb index eb81a825d..6606593bc 100644 --- a/lib/vagrant/provisioners/chef_solo.rb +++ b/lib/vagrant/provisioners/chef_solo.rb @@ -7,6 +7,7 @@ module Vagrant class Config < Chef::Config attr_accessor :cookbooks_path attr_accessor :roles_path + attr_accessor :data_bags_path attr_accessor :recipe_url def initialize @@ -14,6 +15,7 @@ module Vagrant @cookbooks_path = ["cookbooks", [:vm, "cookbooks"]] @roles_path = [] + @data_bags_path = [] end def validate(errors) @@ -27,6 +29,7 @@ module Vagrant def prepare share_cookbook_folders share_role_folders + share_data_bags_folders end def provision! @@ -49,6 +52,12 @@ module Vagrant end end + def share_data_bags_folders + host_data_bag_paths.each_with_index do |data_bag, i| + env.config.vm.share_folder("v-csdb-#{i}", data_bag_path(i), data_bag) + end + end + def setup_solo_config setup_config("chef_solo_solo", "solo.rb", { :node_name => config.node_name, @@ -56,6 +65,7 @@ module Vagrant :cookbooks_path => cookbooks_path, :recipe_url => config.recipe_url, :roles_path => roles_path, + :data_bags_path => data_bags_path, }) end @@ -122,6 +132,10 @@ module Vagrant host_folder_paths(config.roles_path) end + def host_data_bag_paths + host_folder_paths(config.data_bags_path) + end + def cookbook_path(i) folder_path("cookbooks", i) end @@ -130,6 +144,10 @@ module Vagrant folder_path("roles", i) end + def data_bag_path(i) + folder_path("data_bags", i) + end + def cookbooks_path folders_path(config.cookbooks_path, "cookbooks").to_json end @@ -137,6 +155,10 @@ module Vagrant def roles_path folders_path(config.roles_path, "roles").to_json end + + def data_bags_path + folders_path(config.data_bags_path, "data_bags").to_json + end end end end diff --git a/templates/chef_solo_solo.erb b/templates/chef_solo_solo.erb index 6a1a0910b..15de280f9 100644 --- a/templates/chef_solo_solo.erb +++ b/templates/chef_solo_solo.erb @@ -6,6 +6,10 @@ cookbook_path <%= cookbooks_path %> role_path <%= roles_path %> log_level <%= log_level.inspect %> +<% if data_bags_path %> +data_bag_path <%= data_bags_path %> +<% end %> + <% if recipe_url -%> recipe_url "<%= recipe_url %>" <% end -%>