Warn if run list on Chef is empty, not error [GH-1620]

This commit is contained in:
Mitchell Hashimoto 2013-04-19 10:11:43 -06:00
parent 959f454f67
commit c0539d6e31
6 changed files with 15 additions and 5 deletions

View File

@ -1,5 +1,10 @@
## 1.2.2 (unreleased)
IMPROVEMENTS:
- No longer an error if the Chef run list is empty. It is now
a warning. [GH-1620]
BUG FIXES:
- `vagrant package --base` works again. [GH-1615]

View File

@ -52,8 +52,6 @@ module VagrantPlugins
!chef_server_url || chef_server_url.strip == ""
errors << I18n.t("vagrant.config.chef.validation_key_path") if \
!validation_key_path
errors << I18n.t("vagrant.config.chef.run_list_empty") if \
@run_list && @run_list.empty?
{ "chef client provisioner" => errors }
end

View File

@ -61,8 +61,6 @@ module VagrantPlugins
errors = _detected_errors
errors << I18n.t("vagrant.config.chef.cookbooks_path_empty") if \
!cookbooks_path || [cookbooks_path].flatten.empty?
errors << I18n.t("vagrant.config.chef.run_list_empty") if \
!run_list || run_list.empty?
{ "chef solo provisioner" => errors }
end

View File

@ -58,6 +58,10 @@ module VagrantPlugins
end
def run_chef_client
if @config.run_list && @config.run_list.empty?
@machine.ui.warn(I18n.t("vagrant.chef_run_list_empty"))
end
command_env = @config.binary_env ? "#{@config.binary_env} " : ""
command_args = @config.arguments ? " #{@config.arguments}" : ""
command = "#{command_env}#{chef_binary_path("chef-client")} -c #{@config.provisioning_path}/client.rb -j #{@config.provisioning_path}/dna.json #{command_args}"

View File

@ -135,6 +135,10 @@ module VagrantPlugins
end
def run_chef_solo
if @config.run_list && @config.run_list.empty?
@machine.ui.warn(I18n.t("vagrant.chef_run_list_empty"))
end
command_env = @config.binary_env ? "#{@config.binary_env} " : ""
command_args = @config.arguments ? " #{@config.arguments}" : ""
command = "#{command_env}#{chef_binary_path("chef-solo")} -c #{@config.provisioning_path}/solo.rb -j #{@config.provisioning_path}/dna.json #{command_args}"

View File

@ -25,6 +25,8 @@ en:
CFEngine running in "single run" mode. Will execute one file.
cfengine_single_run_execute: |-
Executing run file for CFEngine...
chef_run_list_empty: |-
Warning: Chef solo run list is empty. This may not be what you want.
cfengine_config:
classes_array: |-
@ -569,7 +571,6 @@ en:
cookbooks_path_empty: "Must specify a cookbooks path for chef solo."
cookbooks_path_missing: |-
Cookbook path doesn't exist: %{path}
run_list_empty: "Run list must not be empty."
server_url_empty: "Chef server URL must be populated."
validation_key_path: "Validation key path must be valid path to your chef server validation key."
loader: