From e83260662edf9654c6c4e960a23badde85577556 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 15 Nov 2010 10:42:52 -0800 Subject: [PATCH] Fix chef validations with new blank run lists --- CHANGELOG.md | 4 ++++ lib/vagrant/provisioners/chef.rb | 10 +++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 41736e98f..4570ca81f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ - Network interfaces are now up/down in distinct commands instead of just restarting "networking." [GH-192] - Add missing translation for chef binary missing. [GH-203] + - Fix default settings for Opscode platform and comments. [GH-213] + - Blank client name for chef server now uses FQDN by default, instead of "client" [GH-214] + - Run list can now be nil, which will cause it to sync with chef server (when + chef server is enabled). [GH-214] ## 0.6.7 (November 3, 2010) diff --git a/lib/vagrant/provisioners/chef.rb b/lib/vagrant/provisioners/chef.rb index 0c07c9d42..b552fb190 100644 --- a/lib/vagrant/provisioners/chef.rb +++ b/lib/vagrant/provisioners/chef.rb @@ -136,9 +136,13 @@ module Vagrant errors.add(I18n.t("vagrant.config.chef.validation_key_path")) if !validation_key_path end - if [:chef_solo, :chef_server].include?(top.vm.provisioner) - # Validations shared by both chef solo and server - errors.add(I18n.t("vagrant.config.chef.run_list_empty")) if !run_list || run_list.empty? + if top.vm.provisioner == :chef_solo + # On chef solo, a run list MUST be specified + errors.add(I18n.t("vagrant.config.chef.run_list_empty")) if !json[:run_list] || run_list.empty? + elsif top.vm.provisioner == :chef_server + # On chef server, the run list is allowed to be nil, which causes it + # to sync with the chef server. + errors.add(I18n.t("vagrant.config.chef.run_list_empty")) if json[:run_list] && run_list.empty? end end end