When I updated to chef 0.7.6 this morning, I had an issue with my
attributes (as noted in CHEF-473), causing this error:
can’t convert Chef::Node::Attribute into String (TypeError)
This was because I had attribute code that looked like this:
cluster = Mash.new unless attribute?(“cluster”)
cluster[:ruby_version] ||= “1.8.7_p74”
This worked before 0.7.6, but with the new code in 0.7.6, a new
attribute is no longer initially nil, but an instance of
Chef::Node::Attribute. Thus, this value wasn’t being set properly.
The fix is to use the normal chef nomenclature…either the new, or the
cluster[:ruby_version] = “1.8.7_p74” unless
set_unless[:cluster][:ruby_version] = “1.8.7_p74”
I’m documenting this here in case anyone else runs into the issue, as
fixing the code in chef itself is non-trivial.