AFAIK all variables inside a lambda are “private”: https://docs.puppet.com/puppet/latest/lang_lambdas.html#lambda-scope
> On 30 Jan 2017, at 21:49, Justin Diana <justin.di...@b2b2dot0.com> wrote: > > Hey guys, > > I'm trying to loop through a hash to set a variable and then use it outside > of the loop. For some reason, although my debug shows the variable is > getting set to the correct value, it's NULL as soon as I move up a layer in > the nested loop: > > $lb_info.each |$k, $v| { > $myaddress = '' > $myid = '' > $v.each |$key, $value| { > if $key == 'address' { > $myaddress = $value > notify {"this is a debug message: found ${key}: > ${value}: ${myaddress}" : > loglevel => debug, > } > } > if $key == 'id' { > $myid = $value > notify {"this is a debug message: found ${key}: > ${value}: ${myid}" : > loglevel => debug, > } > } > } > > notify {"this is a debug message: found ${myaddress}: ${myid} for > ${k}" : > loglevel => debug, > } > } > > Everything shows the correct values except for the last notify... it shows > blank values for ${myaddress} and ${myid}. > > Why is that? > > -- > 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/6b011cee-e099-4e43-a0b8-e0810bec81eb%40googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- 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/B29E0104-FDD3-402A-8B99-AA90B85337CB%40gmail.com. For more options, visit https://groups.google.com/d/optout.