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.

Reply via email to