Hi, To my surprise hashes passed to class parameters pulled from hiera with :merge_behavior: deeper, are not merged "as expected", where as hiera_hash does work "as expected". Or to rephrase: they behave differently, despite merge_behavior being set. I found a snippet documenting this here: http://docs.puppetlabs.com/hiera/1/lookup_types.html#deep-merging-in-hiera--120 Might make sense to make these things allot more apparent by listing the caveats and known issues at the top of the documentation and in release notes. That said, Hiera is great and I''m looking forward to future improvements. -- 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+unsubscribe@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/e38fd832-863a-42fc-b028-6b47d922c851%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
jcbollinger
2013-Oct-30 13:08 UTC
[Puppet Users] Re: :merge_behavior: deeper and hiera_hash
On Tuesday, October 29, 2013 9:21:05 PM UTC-5, William Leese wrote:> > Hi, > > To my surprise hashes passed to class parameters pulled from hiera with > :merge_behavior: deeper, are not merged "as expected", where as hiera_hash > does work "as expected". > > Or to rephrase: they behave differently, despite merge_behavior being set. > >Per the docs, the :merge_behavior setting affects how hashes are merged in a "hash merge lookup". Not every hiera lookup is a hash merge lookup, and whether a query is of that kind does not depend on the type of the data retrieved. A standard hiera lookup, such as is performed by the ordinary hiera() function, simply returns the highest-priority datum it finds in the data hierarchy. This is what is used for automated class parameter binding. A hash merge lookup, on the other hand, is what you get from the hiera_hash() function. John -- 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+unsubscribe@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/feb2ce1a-efe5-4b1d-86e2-50d96e0d3c37%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
William Leese
2013-Oct-31 02:07 UTC
[Puppet Users] Re: :merge_behavior: deeper and hiera_hash
On Wednesday, October 30, 2013 10:08:14 PM UTC+9, jcbollinger wrote:> > Per the docs, the :merge_behavior setting affects how hashes are merged in > a "hash merge lookup". Not every hiera lookup is a hash merge lookup, and > whether a query is of that kind does not depend on the type of the data > retrieved. A standard hiera lookup, such as is performed by the ordinary > hiera() function, simply returns the highest-priority datum it finds in the > data hierarchy. This is what is used for automated class parameter > binding. A hash merge lookup, on the other hand, is what you get from the > hiera_hash() function. >Makes sense. I think that the confusion stems from using on hiera_include''s array merge lookup, seeing your class arrays being merged nicely and assuming such behaviour extends to class parameter binding. I understand the reasons maintaining priority lookup for class parameters though. -- 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+unsubscribe@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/b8d4d310-e1c2-4e36-9c2e-b1ffe157a3bd%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.