On Thu, Apr 4, 2013 at 3:02 AM, Erik Dalén <erik.gustav.da...@gmail.com>wrote:
> On Thursday 4 April 2013 at 02:39, Matthaus Owens wrote: > > ======================== > > ## Hiera 1.2.0 Release Notes ## > > ======================== > > # Features > > > > Add deep-merge feature to backend lookups > > > > - Config option :merge_behavior => :native|:deep|:deeper > > - Add optional requirement on deep_merge gem to support > > :deep and :deeper options > > - Update Yaml backend to use Backend.merge_answer > > - Update Json backend to use Backend.merge_answer > > So if I understood it correctly the difference is when the values are > unmergeable and :deeper will give the value from the higher (more specific) > hierarchy level while :deep will instead give the value from the lower > (less specific) hierarchy level. Correct? > I'm not sure if this merge behavior has anything to do with the hierarchy levels. The setting determines how the same value found in multiple backends, (e.g. JSON and YAML) are handled. I agree, there's lots of room for improvement regarding the documentation of this. I also regret letting the options be called "deep" and "deeper" since they really don't relate to depth, but instead they relate to the ordering of the back ends. When using "deep," backends that are listed at the top in the `:backends:` configuration array will take precedence over later backends when multiple backends return a value and the values are of different types (can't be merged). When using "deeper," backends that are listed after other backends that return a value for the same key will take precedence. I guess this could be better said as, when using deep, the first backend to return a value will take precedence over other back ends that also return values that cannot be merged. When using deeper, the last backend to return a value will take precedence over other back ends that return values that cannot be merged. Ugh. Clear as mud. > I don't really see the point of the :deep option then as the point of > hiera is to give the most specific answer for the node in question. > yeah, deep and deeper don't really have anything to do with the hierarchy. They only affect the value when multiple backends are being used and the values cannot be merged across backends. > But could be nice to at least log a warning or something when this happens. > And also document the two options a bit more :) > Agreed! Are you interested in submitting a patch? The code in question is at: https://github.com/puppetlabs/hiera/blob/1.2.0/lib/hiera/backend.rb#L151-L160 and: https://github.com/puppetlabs/hiera/blob/1.2.0/lib/hiera/backend.rb#L193 Hope this helps, -Jeff -- 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 post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.