Am 19.03.2020 um 22:54 schrieb Henrik Lindberg:
On 2020-03-19 22:11, Helmut Schneider wrote:
Hi,

class abc {
   keys($netconfig['interfaces']).each |String $interface| {
     if $netconfig['interfaces'][$interface]['ip6'] {
       $myvariable = 'yes'
       break()
     }
   }

   if $myvariable == 'yes' {
     do something
   }
}

How can I access $myvariable?

No need for a variable or anything - if you do need one do this:

$myvariable = $netconfig['interfaces'].any() |$k, $v| {
    $v['ip6'] =~ NotUndef
}

if $myvariable {
    # do something
}

Works like a charm.

Thank you!

--
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/r52292%2412j4%241%40ciao.gmane.io.

Reply via email to