I just found a solution (at least temporarily) in case someone is interested.
Here’s my helper method:
hash = node[‘app’][‘config’].to_hash
mutable_hash = JSON.parse(hash.dup.to_json)
On Feb 4, 2014, at 5:43 PM, Daniel DeLeo <firstname.lastname@example.org:email@example.com> wrote:
On Tuesday, February 4, 2014 at 3:35 PM, Curtis Stewart wrote:
I’m trying to allow a settings.yml file to be generated from node attributes.
I assumed the following would work, but I’m left with various “!ruby/hash:Chef::Node::ImmutableMash” lines in my yaml file.
I’d like to be able to allow for a very flexible configuration, however, maybe this is just a bad practice and I should use a template with a smaller number of configurations?
There’s a patch to make to_hash convert ImmutableMash to regular Hashes, but it doesn’t correctly handle some cases of nested structures, like an Array of Hashes. It’d be great if you could fix it up: https://tickets.opscode.com/browse/CHEF-3953
If that’s beyond the work you’re willing to do, there’s at least some monkey-patch type workarounds to be found in that and related tickets (though monkey patches are inherently brittle and can be accidentally broken in minor or possibly patch releases, so beware).