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.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/7bb11bed-f83f-3a7e-a0e5-a41557add370%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to