Le 05/06/2019 à 17:24:26-0700, chengkai liang a écrit
Hi,
Thanks for the help.
> I believed you made thing overly complicated. You only have one hash table,
> and
> try to remove the entries that has remove_ of it. Not sure why you need to use
> reduce and map. You can use `each` to go through first key of the hash table,
> then use filter to filter out unwanted keys like,
>
> # this class is use to setup owner and group
> class reduce_test {
> $hash = {
> attribute1 => 1,
> attribute2 => 2,
> attribute3 => 3,
> remove1 => 4,
> remove2 => 5,
> attribute4 => 6,
> attribute5 => 7,
> }
> notice("hash table => ${hash}")
> $h = $hash.filter | $items | {
> $items[0] !~ /^remove/
> }
> notice("hash table after filtering out 'remove*' key = ${h}")
> }
Well....I understand but it's a example, actually I can't do this with
regexp. Of course I can to it with some very long test.
But I will keep your nice suggestion.
Thanks.
--
Albert SHIH
Observatoire de Paris
xmpp: [email protected]
Heure local/Local time:
Thu 06 Jun 2019 01:34:24 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/20190606113622.GH12167%40io.chezmoi.fr.
For more options, visit https://groups.google.com/d/optout.