Thanks. But that did not help. Here is my new code:
modules/virualuser/manifests/
init.pp
class virtualuser( $allusers = hiera('users'))
{
$allusers.each |$key,$value|
{
#code to extract hiera variables not shown
if $virtual == true {
@virtualuser::addvirtualuser { $key:
key => $key,
value => $value,
gid => $gid,
uid => $uid,
..................
}
}
The following define is currently within the same file (but outside of
class definition) as above (virtualuser/manifests/init.pp), I've also
tried to create a separate localuser.pp file and still got the same error
define
virtualuser::addvirtualuser($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,
..............
.........
}
}
- realize is being called in init.pp of a puppet class on a different node
realize(Virtualuser::Addvirtualuser['virtualfoo'])
same error message:
Error: Could not retrieve catalog from remote server: Error 400 on SERVER:
Failed to realize virtual resources Virtualuser::Addvirtualuser[virtualfoo]
on node xx.yy
I'm surprised there is no better way to debug this problem.
On Friday, March 28, 2014 1:40:45 PM UTC-4, Jose Luis Ledesma wrote:
>
> 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] <javascript:>> 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] <javascript:>.
>> 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/acd53a40-e612-49b8-8f5f-f0c6ba1047f0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.