Francois Lafont
unread,Aug 25, 2017, 2:46:58 PM8/25/17Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to puppet...@googlegroups.com
Hi @all, :)
I would like to make a deep merge between 2 hashes:
1. directly in puppet code,
2. with the same behavior that the deep merging of the
lookup() option (when set with 'deep' as merge policy
of course).
I have tried the deep_merge() function from stdlib (version
v4.19.0 in my case) with this code:
--------------------
$h1 = {
key1 => {'subkey' => ['foo', 'bar']},
key2 => {'subkey' => ['foo']},
}
$h2 = {
key2 => {'subkey' => ['bar']}
}
notice(deep_merge($h1, $h2))
--------------------
And here is the result (I have just added indentation):
Notice: Scope(Class[main]):
{
key1 => {subkey => [foo, bar]},
key2 => {subkey => [bar]},
}
But the deep merge I would like should give:
{
key1 => {subkey => [foo, bar]},
key2 => {subkey => [foo, bar]},
}
So my question is: in puppet code, is it possible to make
a deep merge between 2 hashes with the same merge policy
as the lookup() built-in function?
Thanks for your help.