Am Montag, dem 10.01.2022 um 14:29 +0100 schrieb Helmut Schneider:

I'm afraid I still do not unterstand this correctly:

profiles:
   vpn:
     openvpn:
       syslogd:
         40-openvpn.conf:
           openvpn:
             '*.*':                          '/var/log/openvpn.log'

$array = [1].map |$var| {
   keys($profiles).each |$category| {
     if $profiles[$category] =~ Hash {
       keys($profiles[$category]).each |$app| {
         "$app"
       }
     }
   }
}

Not 100% sure this will be correct, since your "profiles" sample above has only 
one entry, but anyway...

I guess what you'd need to do is

$array = $profiles.map |...| {
  ...
}

You can't use each here because it's an iterator that returns one item at a 
time, which would then have to be added to your array, which isn't possible 
(since Puppet variables are immutable). map, OTOH, returns an array (or hash) 
generated from another array (or hash).

For example:

$array = [1, 2, 3].map |$num| { "This is element number ${num}."}

Would result in $array like:

[
  "This is element number 1.",
  "This is element number 2.",
  "This is element number 3."
]

Again, see the example in your first link.

HTH...

Dirk

--

Dirk Heinrichs
Senior Systems Engineer, Delivery Pipeline
OpenText ™ Discovery | Recommind
Phone: +49 2226 15966 18
Email: dhein...@opentext.com<mailto:dhein...@opentext.com>
Website: www.recommind.de
Recommind GmbH, Von-Liebig-Straße 1, 53359 Rheinbach
Vertretungsberechtigte Geschäftsführer Gordon Davies, Madhu Ranganathan, 
Christian Waida, Registergericht Amtsgericht Bonn, Registernummer HRB 10646
This e-mail may contain confidential and/or privileged information. If you are 
not the intended recipient (or have received this e-mail in error) please 
notify the sender immediately and destroy this e-mail. Any unauthorized 
copying, disclosure or distribution of the material in this e-mail is strictly 
forbidden
Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. 
Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten 
haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. 
Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail sind nicht 
gestattet.

-- 
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/7fa88ac660ecfa038908761d1b57983b67e403ed.camel%40opentext.com.

Reply via email to