I have been trying to create a three level hash to dump into a template, but the deepest layer of the hash seems to not work.
My hash: $clusters = { 'Default' => { '127.0.0.1:11211' => { 'hostname' => '127.0.0.1', 'port' => '11211' }, }, } My ERB template (modified for readability): <% @clusters.sort.map do |k,v| -%> <% if v.is_a?(Hash) -%> '<%= k %>' <% @clusters[k].sort.map do |ki, vi| -%> <% if vi.is_a?(Hash) -%> '<%= ki %>' <% @clusters[ki].sort.map do |kii, vii| -%> <% if vi and vi != '' -%> '<%= kii %>' = '<%= vii %>', <% end -%> <% end -%> <% end -%> <% end -%> <% end -%> <% end -%> For some reason that I can't quite figure out, the innermost hash throws a Detail: undefined method `sort' for nil:NilClass error. I assume if ki was not a hash, the if vi.us_a?(Hash) would have been false and skipped that sort. What am I doing wrong here? -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/da61d6e0-40bc-4dca-893a-717dcd44004b%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.