Hi

I try to write a code to delete some key inside a hash. So I got this


  $_dataset = reduce($dataset.map |$key, $value| { {$key => 
delete($value,['remove_key1','remove_key2','remove_key3'])} }) | $result, 
$value | { deep_merge($result, $value)}

so if

  $dataset = {
    name1 => {
      attr1 =>
      attr2 =>
      remove_key1 =>
      remove_key2 =>
      remove_key3 =>
      attr3 =>
      }
      }

it will end up

  $_dataset = {
    name1 => {
      attr1 =>
      attr2 =>
      attr3 =>
      }
      }

So it's working.

But why this *not* working ?

class  (
  Optional[Hash] $remove_key = ['remove_key1','remove_key2','remove_key3'],
  )
  {

  $_dataset = reduce($dataset.map |$key, $value| { {$key => 
delete($value,$remove_key)} }) | $result, $value | { deep_merge($result, 
$value)}

  }

The problem are some key will be remove, some other not. I'm unable to
understand the difference or find out why it delete some key (event not in
the remove_key array), and keep some other.

Regards.






--
Albert SHIH
DIO bātiment 15
Observatoire de Paris
xmpp: [email protected]
Heure local/Local time:
Wed 05 Jun 2019 04:57:36 PM CEST

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/20190605150914.GA7441%40io.chezmoi.fr.
For more options, visit https://groups.google.com/d/optout.

Reply via email to