On Sep 27, 4:45 pm, Matthias Pigulla <m...@webfactory.de> wrote:
> Replying to myself:
>
> > define complex_user($uid, $sshkeys) {
> >    /* ... create user with $name ... */
> >    create_resources("keys_for", $sshkeys)
> > }
>
> > define keys_for($key) { ... }
>
> I just found that when having a $user_name = $name in complex_user, I can 
> access that in keys_for simply as $user_name and it seems to work (TM).
>
> Is that a legitimate approach or discouraged? I've 
> readhttp://docs.puppetlabs.com/guides/scope_and_puppet.htmlbut that does not 
> say anything about definitions?


If your keys_for definition were nested inside your complex_user
definition then I think that would resolve the variable scoping
issue.  If it works at all, that is, which I'm not sure it would.
Otherwise, your approach relies on dynamic scoping, which should evoke
a warning in 2.7.x and will fail in 2.8.x.


John

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to