From
http://docs.puppetlabs.com/puppet/latest/reference/lang_defined_types.html

Type definitions may also be placed inside class definitions; however, this
limits their availability to that class and is not recommended for any
purpose. This is not formally deprecated in this version of Puppet, but may
become so in a future release.

--------

I think the problem is this, you should  put the define in
modules/virtualuser/manifests/virtual/localuser.pp

Obv outside any class.

Regards,
El 28/03/2014 16:59, "S L" <[email protected]> escribió:

> i've moduiles/virtualuser/manifests/init.pp
>
> class virtualuser ( $allusers = hiera('users'))
> {
>   include virtualuser::virtual
>   $allusers.each |$key,$value|
>   {
>     #not showing code to extract all variables from hiera
>
>     if $virtual == true {
>         @virtualuser::virtual::localuser { $key:
>           key        => $key,
>           value      => $value,
>           gid        => $gid,
>           uid        => $uid,
>           homedir    => $homedir,
>           expire     => $expire,
>           ensure     => $ensure,
>           shell      => $shell,
>           groups     => $groups,
>           password   => $password,
>           managehome => $managehome,
>           system     => $system,
>           managekeys => $managekeys
>         }
>     }
> }
>
> same dir i've puppet class virtual.pp
>
> class virtualuser::virtual
> {
>   define localuser
> ($key,$value,$gid,$uid,$homedir,$expire,$ensure,$shell,$groups,$password,$managehome,$system,$managekeys)
>   {
>     #create or remove virtual user
>     group { $key:
>      ensure => $ensure,
>      tag    => 'allgroups',
>      gid    => $gid,
>     }
>
>     user { $key:
>       ensure     => $ensure,
>       shell      => $shell,
>       uid        => $uid,
>       allowdupe  => false,
>       expiry     => $expire,
>       gid        => $gid,
>       groups     => $groups,
>       password   => $password,
>       managehome => $managehome,
>       home       => $homedir,
>       tag        => 'allusers',
>     }
>
>     file { "$homedir":
>         ensure => directory,
>         mode   => 700,
>         owner  => $key,
>         group  => $key
>       }
>
>       file { "$homedir/.ssh":
>         ensure => directory,
>         mode   => 700,
>         owner  => $key,
>         group  => $key,
>         tag    => 'sshdir',
>       }
>
> in another puppet class,  i try to realize a user
>
>    realize (Virtualuser::Virtual::Localuser['virtualuser'])
>
>
> and Error: Could not retrieve catalog from remote server: Error 400 on
> SERVER: Failed to realize virtual resources
> Virtualuser::Virtual::Localuser[virtualuser] on node n1.xx
>
> Please help!  Its been 4 days I'm struggling to get this working.
>
> SL
>
>  --
> 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/90c5032b-8e2d-468a-a159-32c926c3684d%40googlegroups.com<https://groups.google.com/d/msgid/puppet-users/90c5032b-8e2d-468a-a159-32c926c3684d%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CAF_B3df92HikmmVSMpvg%3DPTAOHGL7Ze%2BOFDqy9U9b8Hm7MbbRA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to