On Thu, Jan 08, 2009 at 12:41:14AM -0600, Luke Kanies wrote:
> The problem here is that the block passed to 'setcode' isn't run until
> later, at which point $6 is set to the last user's homedir. Try this:
>
> Facter.add("...") do
> homedir = $6 # dereference immediately
> setcode { homedir }
> end
>
> This works because 'homedir' is local to each fact definition, whereas
> $6 is global. At least, it *should* work. :)
I figured the $6.dup would create a local copy. Guess it works differently for
globals, or I'm missing something obvious. I didn't actually look at what
setcode does, but that explains it.
> Yes, I know you already found a solution, but this is more a ruby
> question than a Puppet/Facter question, and I figure it's worth
> pointing out the correct solution.
Thanks Luke.
--
Jos Backus
jos at catnook.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en
-~----------~----~----~----~------~----~------~--~---