On 28-03-12 14:39, R.I.Pienaar wrote: > > > ----- Original Message ----- >> From: "Martijn Grendelman" <mart...@iphion.nl> > > <snip> > >> http://serverfault.com/questions/368784/puppet-and-templates-how-to-loop-sequently-and-not-randomly >> >> which suggests to do something like >> >> <% aliases.sort_by {|key, value| key}.each_pair do |key, val| -%> >> <% end -%> >> >> Will it work? Is that a proper solution? > > ruby hashes are not stored in predictable order so this will happen, the > proposed > solution should work. > > But as always the best is just to test it and see how it goes, it wont bite :) >
<% aliases.sort_by {|key, value| key}.each do |key, val| -%> seems to do the trick. 'each_pair' doesn't work here, because the sort_by returns an array. Again, I learned something :-) Thanks, Martijn. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.