Merge pull request #6559 from mitchellh/sethvargo/require_nodes_path
Require nodes_path for Chef Zero
This commit is contained in:
commit
63770e5626
|
@ -49,31 +49,6 @@ module VagrantPlugins
|
|||
@synced_folder_type = UNSET_VALUE
|
||||
end
|
||||
|
||||
# @deprecated This is deprecated in Chef and will be removed in Chef 12.
|
||||
def recipe_url=(value)
|
||||
puts "DEPRECATION: The 'recipe_url' setting for the Chef Solo"
|
||||
puts "provisioner is deprecated. This value will be removed in"
|
||||
puts "Chef 12. It is recommended you use the Chef Apply provisioner"
|
||||
puts "instead. The 'recipe_url' setting will be removed in the next"
|
||||
puts "version of Vagrant."
|
||||
|
||||
if value
|
||||
@recipe_url = value
|
||||
end
|
||||
end
|
||||
|
||||
def nfs=(value)
|
||||
puts "DEPRECATION: The 'nfs' setting for the Chef Solo provisioner is"
|
||||
puts "deprecated. Please use the 'synced_folder_type' setting instead."
|
||||
puts "The 'nfs' setting will be removed in the next version of Vagrant."
|
||||
|
||||
if value
|
||||
@synced_folder_type = "nfs"
|
||||
else
|
||||
@synced_folder_type = nil
|
||||
end
|
||||
end
|
||||
|
||||
#------------------------------------------------------------
|
||||
# Internal methods
|
||||
#------------------------------------------------------------
|
||||
|
|
|
@ -73,6 +73,10 @@ module VagrantPlugins
|
|||
errors << I18n.t("vagrant.config.chef.cookbooks_path_empty")
|
||||
end
|
||||
|
||||
if [nodes_path].flatten.compact.empty?
|
||||
errors << I18n.t("vagrant.config.chef.nodes_path_empty")
|
||||
end
|
||||
|
||||
if environment && environments_path.empty?
|
||||
errors << I18n.t("vagrant.config.chef.environment_path_required")
|
||||
end
|
||||
|
|
|
@ -1402,7 +1402,10 @@ en:
|
|||
common:
|
||||
bad_field: "The following settings shouldn't exist: %{fields}"
|
||||
chef:
|
||||
cookbooks_path_empty: "Must specify a cookbooks path for chef solo."
|
||||
cookbooks_path_empty: |-
|
||||
Missing required value for `chef.cookbooks_path'.
|
||||
nodes_path_empty: |-
|
||||
Missing required value for `chef.nodes_path'.
|
||||
environment_path_missing: |-
|
||||
Environment path not found: %{path}
|
||||
environment_path_required: |-
|
||||
|
|
|
@ -82,7 +82,7 @@ describe VagrantPlugins::Chef::Config::ChefZero do
|
|||
it "returns an error" do
|
||||
subject.cookbooks_path = nil
|
||||
subject.finalize!
|
||||
expect(errors).to eq [I18n.t("vagrant.config.chef.cookbooks_path_empty")]
|
||||
expect(errors).to include(I18n.t("vagrant.config.chef.cookbooks_path_empty"))
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -90,7 +90,7 @@ describe VagrantPlugins::Chef::Config::ChefZero do
|
|||
it "returns an error" do
|
||||
subject.cookbooks_path = []
|
||||
subject.finalize!
|
||||
expect(errors).to eq [I18n.t("vagrant.config.chef.cookbooks_path_empty")]
|
||||
expect(errors).to include(I18n.t("vagrant.config.chef.cookbooks_path_empty"))
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -98,7 +98,31 @@ describe VagrantPlugins::Chef::Config::ChefZero do
|
|||
it "returns an error" do
|
||||
subject.cookbooks_path = [nil, nil]
|
||||
subject.finalize!
|
||||
expect(errors).to eq [I18n.t("vagrant.config.chef.cookbooks_path_empty")]
|
||||
expect(errors).to include(I18n.t("vagrant.config.chef.cookbooks_path_empty"))
|
||||
end
|
||||
end
|
||||
|
||||
context "when the nodes_path is nil" do
|
||||
it "returns an error" do
|
||||
subject.nodes_path = nil
|
||||
subject.finalize!
|
||||
expect(errors).to include(I18n.t("vagrant.config.chef.nodes_path_empty"))
|
||||
end
|
||||
end
|
||||
|
||||
context "when the nodes_path is an empty array" do
|
||||
it "returns an error" do
|
||||
subject.nodes_path = []
|
||||
subject.finalize!
|
||||
expect(errors).to include(I18n.t("vagrant.config.chef.nodes_path_empty"))
|
||||
end
|
||||
end
|
||||
|
||||
context "when the nodes_path is an array with nil" do
|
||||
it "returns an error" do
|
||||
subject.nodes_path = [nil, nil]
|
||||
subject.finalize!
|
||||
expect(errors).to include(I18n.t("vagrant.config.chef.nodes_path_empty"))
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -111,7 +135,7 @@ describe VagrantPlugins::Chef::Config::ChefZero do
|
|||
it "returns an error" do
|
||||
subject.environments_path = nil
|
||||
subject.finalize!
|
||||
expect(errors).to eq [I18n.t("vagrant.config.chef.environment_path_required")]
|
||||
expect(errors).to include(I18n.t("vagrant.config.chef.environment_path_required"))
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -119,7 +143,7 @@ describe VagrantPlugins::Chef::Config::ChefZero do
|
|||
it "returns an error" do
|
||||
subject.environments_path = []
|
||||
subject.finalize!
|
||||
expect(errors).to eq [I18n.t("vagrant.config.chef.environment_path_required")]
|
||||
expect(errors).to include(I18n.t("vagrant.config.chef.environment_path_required"))
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -127,7 +151,7 @@ describe VagrantPlugins::Chef::Config::ChefZero do
|
|||
it "returns an error" do
|
||||
subject.environments_path = [nil, nil]
|
||||
subject.finalize!
|
||||
expect(errors).to eq [I18n.t("vagrant.config.chef.environment_path_required")]
|
||||
expect(errors).to include(I18n.t("vagrant.config.chef.environment_path_required"))
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -136,11 +160,9 @@ describe VagrantPlugins::Chef::Config::ChefZero do
|
|||
env_path = "/path/to/environments/that/will/never/exist"
|
||||
subject.environments_path = env_path
|
||||
subject.finalize!
|
||||
expect(errors).to eq [
|
||||
I18n.t("vagrant.config.chef.environment_path_missing",
|
||||
path: env_path
|
||||
)
|
||||
]
|
||||
expect(errors).to include(I18n.t("vagrant.config.chef.environment_path_missing",
|
||||
path: env_path,
|
||||
))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -41,8 +41,9 @@ available below this section.
|
|||
* `environments_path` (string) - A path where environment definitions are
|
||||
located. By default, no environments folder is set.
|
||||
|
||||
* `nodes_path` (string or array) - A list of paths where node objects (in JSON format) are stored. By default, no
|
||||
nodes path is set.
|
||||
* `nodes_path` (string or array) - A list of paths where node objects
|
||||
(in JSON format) are stored. By default, no nodes path is set. This value is
|
||||
required.
|
||||
|
||||
* `environment` (string) - The environment you want the Chef run to be
|
||||
a part of. This requires Chef 11.6.0 or later, and that `environments_path`
|
||||
|
@ -75,6 +76,7 @@ Vagrant.configure("2") do |config|
|
|||
# Specify the local paths where Chef data is stored
|
||||
chef.cookbooks_path = "cookbooks"
|
||||
chef.data_bags_path = "data_bags"
|
||||
chef.nodes_path = "nodes"
|
||||
chef.roles_path = "roles"
|
||||
|
||||
# Add a recipe
|
||||
|
|
Loading…
Reference in New Issue