CHEF-4 - method access to node attributes (node.foo.bar) is deprecated and will be removed


#1

Hello,

I solved lots of CHEF-4 deprecated warnings, but I have no idea how to “solve” this one:

chef (12.21.31)> 
chef > cluster_nodes = search(:node, tagged_cluster_name).map(&:ipaddress)
[2018-03-02T21:08:59+00:00] WARN: method access to node attributes (node.foo.bar) is deprecated and will be removed in Chef 13, please use bracket syntax (node["foo"]["bar"]) (CHEF-4) at (irb):14:in `map'.
Please see https://docs.chef.io/deprecations_attributes.html for further details and information on how to correct this problem.
[2018-03-02T21:08:59+00:00] WARN: method access to node attributes (node.foo.bar) is deprecated and will be removed in Chef 13, please use bracket syntax (node["foo"]["bar"]) (CHEF-4) at (irb):14:in `map'.
Please see https://docs.chef.io/deprecations_attributes.html for further details and information on how to correct this problem.
[2018-03-02T21:08:59+00:00] WARN: method access to node attributes (node.foo.bar) is deprecated and will be removed in Chef 13, please use bracket syntax (node["foo"]["bar"]) (CHEF-4) at (irb):14:in `map'.
Please see https://docs.chef.io/deprecations_attributes.html for further details and information on how to correct this problem.
 => ["10.110.8.28", "10.110.8.44", "10.110.8.34"] 

Thanks!


#2

.map {|n| n['ipaddress'] }.


#3

Awesome man, thanks!!!

chef (12.21.31)> cluster_nodes = search(:node, tagged_cluster_name).map {|n| n['ipaddress'] }.sort
 => ["10.110.8.28", "10.110.8.34", "10.110.8.44"] 

\o/