Chef client accepts nil run list to load run list from server [closes GH-429]
This commit is contained in:
parent
6217a91b5c
commit
ed8bf34153
|
@ -1,6 +1,7 @@
|
|||
## 0.8.3 (unreleased)
|
||||
|
||||
- Fix SSH `exec!` to inherit proper `$PATH`. [GH-426]
|
||||
- Chef client now accepts an empty (`nil`) run list again. [GH-429]
|
||||
|
||||
## 0.8.2 (July 22, 2011)
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ module Vagrant
|
|||
attr_accessor :no_proxy
|
||||
attr_accessor :binary_path
|
||||
attr_accessor :binary_env
|
||||
attr_accessor :run_list
|
||||
attr_writer :run_list
|
||||
|
||||
def initialize
|
||||
@provisioning_path = "/tmp/vagrant-chef-#{self.class.get_and_update_counter}"
|
||||
|
@ -107,15 +107,21 @@ module Vagrant
|
|||
@no_proxy = nil
|
||||
@binary_path = nil
|
||||
@binary_env = nil
|
||||
@run_list = []
|
||||
@run_list = nil
|
||||
end
|
||||
|
||||
# This returns the json that is merged with the defaults and the
|
||||
# user set data.
|
||||
def merged_json
|
||||
{ :instance_role => "vagrant",
|
||||
:run_list => run_list
|
||||
}.merge(json || {})
|
||||
original = { :instance_role => "vagrant" }
|
||||
original[:run_list] = @run_list if @run_list
|
||||
original.merge(json || {})
|
||||
end
|
||||
|
||||
# Returns the run list, but also sets it up to be empty if it
|
||||
# hasn't been defined already.
|
||||
def run_list
|
||||
@run_list ||= []
|
||||
end
|
||||
|
||||
# Adds a recipe to the run list
|
||||
|
|
|
@ -25,6 +25,17 @@ class ChefProvisionerTest < Test::Unit::TestCase
|
|||
assert result !~ /"json":/
|
||||
end
|
||||
|
||||
should "not include the 'run_list' key in json if not accessed" do
|
||||
result = @config.merged_json
|
||||
assert !result.has_key?(:run_list)
|
||||
end
|
||||
|
||||
should "include the 'run_list' key in json if it is set" do
|
||||
@config.run_list << "foo"
|
||||
result = @config.merged_json
|
||||
assert result.has_key?(:run_list)
|
||||
end
|
||||
|
||||
should "provide accessors to the run list" do
|
||||
@config.run_list << "foo"
|
||||
assert !@config.run_list.empty?
|
||||
|
|
Loading…
Reference in New Issue