ripienaar / puppet-module-data

Hiera backend that stores data in a module
74 stars 43 forks source link

Hiera merging defaulting to native #25

Closed elijahsgh closed 8 years ago

elijahsgh commented 9 years ago

Configuration exists in several yaml files that I would like to merge together.

When using hiera.yaml with merge_behavior: deeper the expected behavior happens. If I move merge_behavior: deeper out of the top level hiera.yaml and into the module's data/hiera.yaml the behavior defaults to native merging. I would like my module to be independent of global configuration and be able to function with the merge_behavior specified within the module.

I have put together a sort of hacky fix that loads the module's merged config and then replaces it before the key is returned here: https://github.com/tamarintech/puppet-module-data/commit/8e30018d2455bb13de655ee8fa6def960a53ebd7

I'm not sure that is the ideal way to go about changing Hiera's merge_behavior to deeper.

ripienaar commented 9 years ago

hiera just doesnt support this today. Seems hiera is being rewritten for puppet 4 by puppet labs to be able to do this - so that they can achieve other goals.

For today you just cant do it :(

Your solution is likely to break badly on multi threaded ruby web servers :)

elijahsgh commented 9 years ago

Yea, the Hiera::Config.load approach seems pretty terrible.

I guess the only other approach if I wanted this now would be to re-implement deeper merge within module_data?

ripienaar commented 9 years ago

yeah i guess, but I doubt I'd merge that :)

elijahsgh commented 9 years ago

Understood. :+1: