Virtual Resources in PE3.7.0

27 views
Skip to first unread message

Varun Utagikar

unread,
Dec 18, 2014, 2:46:44 AM12/18/14
to puppet...@googlegroups.com
Hello All

I could successfully declare and realize virtual users in PE 3.2.3. I am now testing the same with PE 3.7.0. Unfortunately the user is not being realized and I am getting no warnings/errors.

I am pasting a snippet of my module manifests :

/etc/puppetlabs/puppet/modules/users/manifests/init.pp

<snip>
class users {
        @users::virtual { 'varun':
                uid     =>      1002,
                pass    =>      '$1$Qrt51$JpQOHlU9lMpthG9U5dWiG.',
                name    =>      'admin',
}
}
</snip>

/etc/puppetlabs/puppet/modules/users/manifests/virtual.pp

<snip>
define users::virtual ($uid,$name,$pass) {

  user { $title:
    ensure            =>  'present',
    uid               =>  $uid,
    gid               =>  $title,
    shell             =>  '/bin/bash',
    home              =>  "/home/${title}",
    comment           =>  $name,
    password          =>  $pass,
    managehome        =>  true,
  }
}
</snip>
/etc/puppetlabs/puppet/manifests/nodes/hdpnamenode1.pp

<snip>
node    default {
}
###########################################
node    'hdpnamenode1.xor.in' {
        include users
        realize (Users::Virtual ['varun'])
}
</snip>

All hostnames can be resolved . I also referenced https://docs.puppetlabs.com/puppet/latest/reference/lang_virtual.html 

Help would be apprciated.

Thanks in Advance

Varun

Varun Utagikar

unread,
Dec 18, 2014, 2:47:44 AM12/18/14
to puppet...@googlegroups.com
I am using CentOS 6.6 x86_64 
uname -a
Linux puppet.xor.in 2.6.32-504.1.3.el6.x86_64 #1 SMP Tue Nov 11 17:57:25 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

Felix Frank

unread,
Dec 18, 2014, 4:18:31 AM12/18/14
to puppet...@googlegroups.com
On 12/18/2014 08:46 AM, Varun Utagikar wrote:
> node default {
> }
> ###########################################
> node 'hdpnamenode1.xor.in' {
> include users
> realize (Users::Virtual ['varun'])
> }

Weird.

Please sprinkle all the code that you pasted with notify resources and
notice() calls, so that you get immediate feedback on both master and
agent of what code paths are trodden.

For fun, try and realize using

Users::Virtual<| title == 'varun' |>

and even

Users::Virtual<| |>

Good luck,
Felix

Felix Frank

unread,
Dec 18, 2014, 4:22:17 AM12/18/14
to puppet...@googlegroups.com
On 12/18/2014 10:18 AM, Felix Frank wrote:
>> realize (Users::Virtual ['varun'])

Oh I just noticed - are you using parser=future now?

I seem to recall a comment from Erik that the space in the resource
reference is a problem now, i.e.

Users::Virtual ['varun'] # wrong

vs

Users::Virtual['varun'] # right

...but I might have that wrong altogether.

HTH,
Felix

Varun Utagikar

unread,
Dec 18, 2014, 11:08:59 PM12/18/14
to puppet...@googlegroups.com
Hey Felix

I tried realizing the user via :

Users::Virtual<| title == 'varun' |> and also with
realize Users::Virtual['varun']

but to no avail.

I put a notify in my manifest but it gives no significant o/p help just :

/etc/puppetlabs/puppet/modules/users/manifests/init.pp
<snip>
class users {
        notify { 'Adding User varun' : }
        @users::virtual::localuser { 'varun':
                uid     =>      1002,
                pass    =>      '$1$Qrt51$JpQOHlU9lMpthG9U5dWiG.',
                name    =>      'admin',
}
}
</snip> 

o/p snip

<snip>
Debug: Executing '/sbin/chkconfig pe-mcollective'
Notice: Adding User varun
Notice: /Stage[main]/Users/Notify[Adding User varun]/message: defined 'message' as 'Adding User varun'
Debug: /Stage[main]/Users/Notify[Adding User varun]: The container Class[Users] will propagate my refresh event
Debug: Class[Users]: The container Stage[main] will propagate my refresh event
Debug: Finishing transaction 42629900
</snip>

Any idea to what mistake am I doing ?

Thanks
Varun

Felix Frank

unread,
Dec 19, 2014, 4:47:40 AM12/19/14
to puppet...@googlegroups.com
On 12/19/2014 05:08 AM, Varun Utagikar wrote:
>
> Any idea to what mistake am I doing ?

Well, kind of.

The code you posted originally was not accurate, apparently, for you are
actually declaring a virtual resource of type users::virtual::localuser
- this cannot ever be realized by a users::virtual collector.

Varun Utagikar

unread,
Dec 19, 2014, 11:35:54 PM12/19/14
to puppet...@googlegroups.com
I am so sorry Felix

I was experimenting with different methods My manifest is as below (ignore ::localuser)

/etc/puppetlabs/puppet/modules/users/manifests/init.pp
<snip>
class users {
        notify { 'Adding User varun' : }
        @users::virtual { 'varun':
                uid     =>      1002,
                pass    =>      '$1$Qrt51$JpQOHlU9lMpthG9U5dWiG.',
                name    =>      'admin',
}
}
</snip> 

o/p snip

<snip>
Debug: Executing '/sbin/chkconfig pe-mcollective'
Notice: Adding User varun
Notice: /Stage[main]/Users/Notify[Adding User varun]/message: defined 'message' as 'Adding User varun'
Debug: /Stage[main]/Users/Notify[Adding User varun]: The container Class[Users] will propagate my refresh event
Debug: Class[Users]: The container Stage[main] will propagate my refresh event
Debug: Finishing transaction 42629900
</snip>

Am sorry for the goof up :(

Felix Frank

unread,
Dec 22, 2014, 10:43:32 AM12/22/14
to puppet...@googlegroups.com
On 12/20/2014 05:35 AM, Varun Utagikar wrote:
> Am sorry for the goof up

Never mind.

Please, as originally requested, add notice() calls and notify resources
to *all* pertinent code paths, especially the body of define users::virtual.
Reply all
Reply to author
Forward
0 new messages