summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Larionov <ivan.larionov@skype.net>2014-10-18 04:44:49 +0400
committerIvan Larionov <ivan.larionov@skype.net>2014-10-18 04:44:49 +0400
commit84447d69f1c963e6579f9716878bff8de3aac396 (patch)
treeb2638aee46e93f233bb2ca411a80b5fad440fbc9
parent9b3e925188a41bbea954429ac81ffdf65e936eda (diff)
downloadchef-84447d69f1c963e6579f9716878bff8de3aac396.tar.gz
Empty run_list should result in empty array when using node.to_hash.
-rw-r--r--lib/chef/node.rb4
-rw-r--r--spec/unit/node_spec.rb3
2 files changed, 5 insertions, 2 deletions
diff --git a/lib/chef/node.rb b/lib/chef/node.rb
index 327da67b1c..5f788af4d4 100644
--- a/lib/chef/node.rb
+++ b/lib/chef/node.rb
@@ -397,7 +397,7 @@ class Chef
end
index_hash["recipe"] = run_list.recipe_names if run_list.recipe_names.length > 0
index_hash["role"] = run_list.role_names if run_list.role_names.length > 0
- index_hash["run_list"] = run_list.run_list if run_list.run_list.length > 0
+ index_hash["run_list"] = run_list.run_list_items
index_hash
end
@@ -409,7 +409,7 @@ class Chef
display["normal"] = normal_attrs
display["default"] = attributes.combined_default
display["override"] = attributes.combined_override
- display["run_list"] = run_list.run_list
+ display["run_list"] = run_list.run_list_items
display
end
diff --git a/spec/unit/node_spec.rb b/spec/unit/node_spec.rb
index 00879dcb13..9c5389393d 100644
--- a/spec/unit/node_spec.rb
+++ b/spec/unit/node_spec.rb
@@ -682,6 +682,9 @@ describe Chef::Node do
describe "to_hash" do
it "should serialize itself as a hash" do
+ # Empty run_list should return an empty array
+ node.to_hash["run_list"].should == []
+
node.chef_environment("dev")
node.default_attrs = { "one" => { "two" => "three", "four" => "five", "eight" => "nine" } }
node.override_attrs = { "one" => { "two" => "three", "four" => "six" } }