[chef] Re: converting attributes to ruby hash


Chronological Thread 
  • From: Seth Chisamore < >
  • To: "< >" < >
  • Subject: [chef] Re: converting attributes to ruby hash
  • Date: Wed, 6 Feb 2013 21:10:59 +0000
  • Accept-language: en-US

Igor,
From your stackoverflow question I would say you are having issues because 
you are accessing the attributes using dot notation. Try:

config = node['myapp']['config'].to_hash
JSON.parse(config.to_json)

-- 
Seth Chisamore
Software Development Engineer, Opscode, Inc.
IRC, Skype, Twitter, Github: schisamo

On Feb 6, 2013, at 3:54 PM, 
< >
 wrote:

> Hi!
> 
> I've been wrestling with this issue ever since we got auto-upgraded to Chef 
> 11,
> and I can't find a good solution. How do I recursively convert an attribute
> into an ordinary ruby hash? I've posted a better description of the problem 
> on
> stack overflow:
> 
> http://stackoverflow.com/questions/14738364/chef-11-any-way-to-turn-attributes-into-a-ruby-hash
> 
> I would love any pointers here!
> 
> Thanks,
> --Igor
> 

 [0] https://github.com/opscode/chef/blob/master/lib/chef/node.rb#L356-L368



Archive powered by MHonArc 2.6.16.

§