That's the clearest explanation I've came across, thanks a lot !

I'll go with the define; I thought I had found a quick way to reuse some 
code; I was halfway there, looks like. :-)

Thanks again,

--Jeff

On Monday, 14 December 2015 10:42:53 UTC-5, Jean-Francois Gratton wrote:
>
> Good morning everyone,
>
> I'm trying my hand with subclasses and using parametrized (sub-)classes.
>
> Here's the module layout, and what I'm trying to acheive:
>
> */etc/modules/users/manifests/sysadmins.pp*
> class users::sysadmins
> {
>         realize (Group['sysadmins'])
>         include users::sysadmins::jfg1
>         include users::sysadmins::jfg2
> }
> and then I'd have, in */etc/modules/users/manifests/sysadmins/jfg1.pp* :
> class users::sysadmins::jfg1
> {
>         @user   { 'jfg1' :
>                         comment => 'JFG1 test accnt',
>                         ensure => present,
>                         gid => 'sysadmins',
> [snip]
>                      }
>            realize (User['jfg1'])
> }
>
> Now, I'd want some common files to be put into $HOME, regardless of the 
> user being created. I've thought of adding this:
>
> */etc/puppet/modules/users/sysadmins/commonfiles.pp* :
> class users::sysadmins::commonfiles($homedirectory, $username)
> {
>         file    { "${homedirectory}/.profile" :
>                         ensure => present,
>                         owner => "${username}",
>                         group => 'sysadmins',
>                         source => 
> "puppet:///modules/users/profiles/${username}-profile",
>                 }
> [snip]
> }
> ($homedirectory has to be explicitely passed to this module because $HOME 
> could be /export/home, /home/ or other combinations -> /Users/$user on OSX, 
> for instance)
>
> Now, back to /etc/modules/users/manifests/sysadmins/jfg1.pp, right after 
> the realize User[] line, I'd call the commonfiles subclass with:
>   include users::sysadmins::commonfiles("/export/home/jfg1", "jfg1")
>
> Except that I get this error:
>
> Error: Unknown function users::sysadmins::commonfiles at 
> /etc/puppet/modules/users/manifests/sysadmins/jfg1.pp:61 on node XXX
>
>
> I'm not sure of what am I missing here.
>
> Any pointers ?
>
> Regards,
>
> --Jeff
>

-- 
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/bbf76a30-3b54-44d7-8d31-f337a69b5a69%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to