From ec85548bd6eabf0c9cddef615abc77ae7b913e02 Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Thu, 19 Nov 2015 16:16:30 -0800 Subject: [PATCH] Support arrays for data_bags_path Fixes GH-5988 --- plugins/provisioners/chef/provisioner/chef_solo.rb | 2 +- templates/provisioners/chef_solo/solo.erb | 4 ++-- templates/provisioners/chef_zero/zero.erb | 3 ++- website/docs/source/v2/provisioning/chef_solo.html.md | 5 +++-- website/docs/source/v2/provisioning/chef_zero.html.md | 5 +++-- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/plugins/provisioners/chef/provisioner/chef_solo.rb b/plugins/provisioners/chef/provisioner/chef_solo.rb index fd8582138..a436a8485 100644 --- a/plugins/provisioners/chef/provisioner/chef_solo.rb +++ b/plugins/provisioners/chef/provisioner/chef_solo.rb @@ -165,7 +165,7 @@ module VagrantPlugins recipe_url: @config.recipe_url, nodes_path: guest_paths(@node_folders), roles_path: guest_paths(@role_folders), - data_bags_path: guest_paths(@data_bags_folders).first, + data_bags_path: guest_paths(@data_bags_folders), environments_path: guest_paths(@environments_folders).first } end diff --git a/templates/provisioners/chef_solo/solo.erb b/templates/provisioners/chef_solo/solo.erb index a3b01ed3b..7bfc32717 100644 --- a/templates/provisioners/chef_solo/solo.erb +++ b/templates/provisioners/chef_solo/solo.erb @@ -8,12 +8,12 @@ cookbook_path <%= cookbooks_path.inspect %> role_path <%= roles_path.size == 1 ? roles_path.first.inspect : roles_path.inspect %> <% end %> log_level <%= log_level.inspect %> -verbose_logging <%= verbose_logging.inspect %> +verbose_logging <%= verbose_logging.inspect %> encrypted_data_bag_secret <%= encrypted_data_bag_secret.inspect %> <% if data_bags_path -%> -data_bag_path <%= data_bags_path.inspect %> +data_bag_path <%= data_bags_path.size == 1 ? data_bags_path.first.inspect : data_bags_path.inspect %> <% end %> <% if recipe_url -%> diff --git a/templates/provisioners/chef_zero/zero.erb b/templates/provisioners/chef_zero/zero.erb index 8c4b76407..fa533152b 100644 --- a/templates/provisioners/chef_zero/zero.erb +++ b/templates/provisioners/chef_zero/zero.erb @@ -9,6 +9,7 @@ role_path <%= roles_path.size == 1 ? roles_path.first.inspect : roles_path.inspe <% end %> log_level <%= log_level.inspect %> verbose_logging <%= verbose_logging.inspect %> + <% if !enable_reporting %> enable_reporting <%= enable_reporting.inspect %> <% end %> @@ -16,7 +17,7 @@ enable_reporting <%= enable_reporting.inspect %> encrypted_data_bag_secret <%= encrypted_data_bag_secret.inspect %> <% if data_bags_path -%> -data_bag_path <%= data_bags_path.inspect %> +data_bag_path <%= data_bags_path.size == 1 ? data_bags_path.first.inspect : data_bags_path.inspect %> <% end %> <% if environments_path %> diff --git a/website/docs/source/v2/provisioning/chef_solo.html.md b/website/docs/source/v2/provisioning/chef_solo.html.md index a43232bed..77d3825ab 100644 --- a/website/docs/source/v2/provisioning/chef_solo.html.md +++ b/website/docs/source/v2/provisioning/chef_solo.html.md @@ -36,8 +36,9 @@ available below this section. are stored. By default this is "cookbooks", expecting a cookbooks folder relative to the Vagrantfile location. -* `data_bags_path` (string) - A path where data bags are stored. By default, no - data bag path is set. +* `data_bags_path` (string or array) - A path where data bags are stored. By + default, no data bag path is set. Chef 12 or higher is required to use the + array option. Chef 11 and lower only accept a string value. * `environments_path` (string) - A path where environment definitions are located. By default, no environments folder is set. diff --git a/website/docs/source/v2/provisioning/chef_zero.html.md b/website/docs/source/v2/provisioning/chef_zero.html.md index 48b691cf8..e409dc26a 100644 --- a/website/docs/source/v2/provisioning/chef_zero.html.md +++ b/website/docs/source/v2/provisioning/chef_zero.html.md @@ -35,8 +35,9 @@ available below this section. are stored. By default this is "cookbooks", expecting a cookbooks folder relative to the Vagrantfile location. -* `data_bags_path` (string) - A path where data bags are stored. By default, no - data bag path is set. +* `data_bags_path` (string or array) - A path where data bags are stored. By + default, no data bag path is set. Chef 12 or higher is required to use the + array option. Chef 11 and lower only accept a string value. * `environments_path` (string) - A path where environment definitions are located. By default, no environments folder is set.