- From: Bryan Berry <
>
- To:
- Subject: [chef] node attribute initialized with empty array reset to nil in recipe in Chef 11
- Date: Mon, 18 Feb 2013 22:20:13 +0100
Dear Chefs,
I am having some pain w/ the Chef 11 migration. The following code
works fine w/ Chef 10.* but fails on chef 11.*
https://github.com/lusis/chef-logstash/blob/master/attributes/default.rb#L4
default['logstash']['join_groups'] = []
https://github.com/lusis/chef-logstash/blob/master/recipes/default.rb#L31
node['logstash']['join_groups'].each do |grp|
group grp do
members node['logstash']['user']
action :modify
append true
only_if "grep -q '^#{grp}:' /etc/group"
end
Here is the error I get. Apparently it somehow is set to nil . What
am i doing wrong?
NoMethodError
-------------
undefined method `each' for nil:NilClass
Cookbook Trace:
---------------
/etc/vagrant-chef/chef-solo-1/cookbooks/logstash/recipes/default.rb:31:in
`from_file'
/etc/vagrant-chef/chef-solo-1/cookbooks/fao-logstash/recipes/server.rb:10:in
`from_file'
Relevant File Content:
----------------------
/etc/vagrant-chef/chef-solo-1/cookbooks/logstash/recipes/default.rb:
24: directory node['logstash']['basedir'] do
25: action :create
26: owner "root"
27: group "root"
28: mode "0755"
29: end
30:
31>> node['logstash']['join_groups'].each do |grp|
32: group grp do
33: members node['logstash']['user']
34: action :modify
35: append true
- [chef] node attribute initialized with empty array reset to nil in recipe in Chef 11, Bryan Berry, 02/18/2013
Archive powered by MHonArc 2.6.16.