Unable to do "puppet apply nodes.pp"

172 views
Skip to first unread message

Justin tim

unread,
Sep 10, 2014, 3:37:19 PM9/10/14
to puppet...@googlegroups.com
Hi,

Can anybody please help me in resolving the below issue :

Problem :

My basic manifest file in which i just wish to ensure that "katie" is present.

# cat /etc/puppet/manifests/user-absent.pp
user {'katie':
      ensure => present,
    }

When i run :

# puppet apply user-absent.pp
Notice: Compiled catalog for puppet in environment production in 0.57 seconds
Notice: Finished catalog run in 0.08 seconds

As seen, the changes do not take place i.e the user doesn't get added. It simple say's "Catalog finished" without actually doing anything.

Please help me in rectifying the above issue. 

Best Regards,

Justin.



Felix Frank

unread,
Sep 11, 2014, 10:49:10 AM9/11/14
to puppet...@googlegroups.com
On 09/10/2014 09:37 PM, Justin tim wrote:
> /
>
> As seen, the changes do not take place i.e the user doesn't get added.
> It simple say's "Catalog finished" without actually doing anything.
> /


Can you share the output of the following?

getent passwd katie

David Bryant-Moore

unread,
Sep 15, 2014, 9:31:14 AM9/15/14
to puppet...@googlegroups.com
Hi Justin.

In Puppet Free Open Source [FOSS] the user-contributed module path is: /etc/puppet/modules/<module name>
In Puppet Enterprise, [PE] the user-contributed module path is: /etc/puppetlabs/puppet/modules/<module name>

Modules need to be provisioned in these directories so that they can be picked up on a Puppet Agent run.

In your example, user-absent.pp, I note you're not wrapping the resource with a class definition. This is required, as below:

class user-absent {
  user {'katie':
      ensure => present,
    }
}

I'd like you to try the following:

[1] Create the module directory user-absent in the appropriate module path, as per your Puppet version [FOSS/PE]

[2] Ensure you change the name of your file from <module path>/user-absent/manifests/user-absent.pp to <module path>/user-absent/manifests/init.pp

[3] Create a class declaration in: <module path>/user-absent/tests/init.pp, containing:

include user-absent

[4] cd to your module path as above, and run:

puppet apply user-absent/tests/init.pp

You should see the katie user created in the output from puppet apply.

Please advise regarding the results.

Also, you may want to have a look at this guide to writing modules:



Kind Regards.


David Bryant-Moore.

shashank

unread,
Sep 17, 2014, 8:46:02 AM9/17/14
to puppet...@googlegroups.com
Hi Justin,

There is no issue with the syntax and the approach you made to add the user 'kate', it is absolutely right.
You are getting the desired output might be because.

Note: Considering that you are running these commands at the puppet-master
i.e example@puppet-master manifests]# puppet apply user-absent.pp

1)There may be the user 'kate' already exists.So,please do confirm that.
as per the  @Felix.Frank suggestion please check the output of 'getent passwd katie'.

2)Please checkout these ruby libraries should be available
ruby-libs
ruby
ruby-shadow

Jürgen Hermann

unread,
Sep 18, 2014, 7:22:22 PM9/18/14
to puppet...@googlegroups.com
The Puppet file you pass to an apply is basically a full site.pp, so try adding a "node default {…}" around your resources.

See https://github.com/jhermann/devpi-puppet/blob/master/site.pp#L31 for an example.

 

jcbollinger

unread,
Sep 19, 2014, 11:51:21 AM9/19/14
to puppet...@googlegroups.com


On Thursday, September 18, 2014 6:22:22 PM UTC-5, Jürgen Hermann wrote:
The Puppet file you pass to an apply is basically a full site.pp, so try adding a "node default {…}" around your resources.

See https://github.com/jhermann/devpi-puppet/blob/master/site.pp#L31 for an example.



No, a node block should be unnecessary in this case.  Any declarations appearing at top scope apply to all nodes.  It is in fact possible to support a full-scale site without any node blocks at all (not even a default node).

The most likely explanation is that the named user already exists, which is what Felix was probing.  It is also possible that the problem is related to a missing Ruby module (e.g. ruby-shadow, as shashank suggested), but in that case I would have expected Puppet to emit an error message.


John

Justin tim

unread,
Sep 20, 2014, 2:46:22 PM9/20/14
to puppet...@googlegroups.com
Hi all,

Thanks for all your help and suggestions. The issue got resolved.

It was a silly mistake that i was doing. I was creating the manifest in wrong dir path. My actual environment where puppet would look for manifest files is ------/etc/puppet/environment/production/manfiest.

And i was placing my manifest files under /etc/puppet/manifest. I read all of your suggestions and applied each one of them turn by turn, and it seems to be working fine for me.

It would be of great help if someone could tell me how to push files on multiple clients from the puppet master server ( though i understand that puppet is a "pull" system and not a "push" ) using 'puppet apply file.pp' . I came accross an article saying that "puppet kick" does a push, but again read somewhere that it is depricated in newer versions of puppet.

Would require your expert advise. Kindly suggest.

Thanks in Advance.

Felix Frank

unread,
Sep 20, 2014, 2:55:31 PM9/20/14
to puppet...@googlegroups.com
On 09/20/2014 08:46 PM, Justin tim wrote:

It was a silly mistake that i was doing. I was creating the manifest in wrong dir path. My actual environment where puppet would look for manifest files is ------/etc/puppet/environment/production/manfiest.

Does not compute. Your original post stated that you used

puppet apply user-absent.pp

which looks up the current directory and no other locations.

I suspect that the information you presented was incomplete or inaccurate. This is acceptable, but please try and be more responsive to the fellow users who take the time and try to help you out.


t would be of great help if someone could tell me how to push files on multiple clients from the puppet master server ( though i understand that puppet is a "pull" system and not a "push" ) using 'puppet apply file.pp' . I came accross an article saying that "puppet kick" does a push, but again read somewhere that it is depricated in newer versions of puppet.

Please open a new thread if you have followup questions that are rather unrelated to the original topic. Make sure to elaborate on your desired scenario, so that everyone can give you more educated advice.

Justin tim

unread,
Sep 20, 2014, 10:20:22 PM9/20/14
to puppet...@googlegroups.com

Hello Felix,

I was able to simulate the issue again. Attached are the screenshots, showing a successful run of user creation and an unsuccessful run.
As shown, the changes don't get applied when i run 'puppet apply' from the path -----> /etc/puppet/manifests
But when i change the path to ----> /etc/puppet/environments/production/manifests, it runs perfectly.


I have set 'environmentpath' in puppet.conf to below
 environmentpath = $confdir/environments

where $confdir ---> /etc/puppet

is there something that i'm still missing out ?

Kindly let me know if more information is required.


Best Regards,

Justin
successful-run.jpg
unsuccessful-run.jpg
puppet.conf.jpg

Felix Frank

unread,
Sep 21, 2014, 9:52:58 AM9/21/14
to puppet...@googlegroups.com
On 09/21/2014 04:20 AM, Justin tim wrote:
> But when i change the path to
> ----> /etc/puppet/environments/production/manifests, it runs perfectly.
>
>
> I have set 'environmentpath' in puppet.conf to below
> environmentpath = $confdir/environments
>
> where $confdir ---> /etc/puppet
>
> is there something that i'm still missing out ?
>
> Kindly let me know if more information is required.

Huh, this is quite bizarre. What version of Puppet is this?

Can you repeat the application of the dysfuntional manifest, with
`puppet apply -dv`, and paste the output somewhere?

Thanks,
Felix

Justin Timberlake

unread,
Sep 21, 2014, 12:00:07 PM9/21/14
to puppet...@googlegroups.com
Hello Felix,

Im using Puppet version 3.7.0

I tried applying the dysfunctional manifest ( this time for a new user 'nathan' ). Attached is the debug output.


Thanks in Advance
Justin


--
You received this message because you are subscribed to a topic in the Google Groups "Puppet Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/puppet-users/g1sFQ9-HqzE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/541ED816.5050006%40Alumni.TU-Berlin.de.
For more options, visit https://groups.google.com/d/optout.

debug-output.txt

Felix Frank

unread,
Sep 21, 2014, 12:33:09 PM9/21/14
to puppet...@googlegroups.com
On 09/21/2014 05:59 PM, Justin Timberlake wrote:
> Hello Felix,
>
> Im using Puppet version 3.7.0
>
> I tried applying the dysfunctional manifest ( this time for a new user
> 'nathan' ). Attached is the debug output.
>
>
> Thanks in Advance
> Justin

Hey,

thanks - should have checked myself before asking. This doesn't shed
much light.

Can you try other combinations?

- running this manifest with a full path specification
- running this manifest with a full path specification with CWD of the
environment dir
- running this manifest not from a file but through `puppet apply -e
'user { "nathatn": ensure => present }
- same as above from CWD /
- same as above from CWD of the environment dir

etc.

Something is weird here. Might be a latent bug. Please note that 3.7.1
fixed some regressions in connection with directory environments, which
you are using. If you can easily try the new release, I would be curious
whether it exhibits the same issue.

Thanks again,
Felix

Justin Timberlake

unread,
Sep 21, 2014, 1:25:22 PM9/21/14
to puppet...@googlegroups.com
Hello Felix,

Some strange observations :

I tried running 'puppet apply' by giving the path specification of the dysfunctional manifest and i got through, below is the output

puppet:~ # puppet apply /etc/puppet/manifests/user-absent.pp
Notice: Compiled catalog for puppet in environment production in 0.37 seconds
Notice: /Stage[main]/Main/User[Tina]/ensure: created
Notice: Finished catalog run in 0.88 seconds

But the strange thing is that when i checked the Puppet webconsole, the path shown in the logs is that of the environment i.e /etc/puppet/environments/production/manifests/.

Attached is the screenshot of the webconsole.


* Running 'puppet apply' by giving the path specification of the environment dir ( /etc/puppet/environments/production/manifests/ ) works fine.

* Also running `puppet apply -e 'user { "nathatn": ensure => present } from any path works fine.


Thanks,

Justin





Felix

--
You received this message because you are subscribed to a topic in the Google Groups "Puppet Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/puppet-users/g1sFQ9-HqzE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to puppet-users...@googlegroups.com.
puppet-websoncsole.jpg

Felix Frank

unread,
Sep 21, 2014, 3:11:08 PM9/21/14
to puppet...@googlegroups.com
On 09/21/2014 07:25 PM, Justin Timberlake wrote:
But the strange thing is that when i checked the Puppet webconsole, the path shown in the logs is that of the environment i.e /etc/puppet/environments/production/manifests/.

Inconclusive.

I suspect that this may be some compatibility setting affecting you in weird ways. Please do consider updating to 3.7.1.

Best,
Felix

Justin Timberlake

unread,
Sep 22, 2014, 10:47:38 AM9/22/14
to puppet...@googlegroups.com
Hello Felix,


I'l upgrade my Puppet master and client to 3.7.1. 

Thanks,
Justin.

--
You received this message because you are subscribed to a topic in the Google Groups "Puppet Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/puppet-users/g1sFQ9-HqzE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to puppet-users...@googlegroups.com.

Felix Frank

unread,
Sep 23, 2014, 4:47:16 PM9/23/14
to puppet...@googlegroups.com
On 09/21/2014 05:59 PM, Justin Timberlake wrote:
> puppet:/etc/puppet/manifests # puppet apply -dv user-absent.pp
> Debug: Runtime environment: run_mode=user, ruby_version=1.8.7, puppet_version=3.7.0
> Debug: Executing '/usr/bin/env PUPPET_DASHBOARD_URL=http://puppet.novell.com:3000 /usr/share/puppet-dashboard/bin/external_node puppet'

Ah, so you're using an ENC.

It has been brought to my attention that puppet apply is broken when an
ENC is in use, since 3.7.0. This is PUP-3258.

I'm afraid the 3.7.1 update will not help you.

There will hopefully be a remedy soon. Thanks to Will for reporting.

Cheers,
Felix

Justin tim

unread,
Sep 24, 2014, 2:37:25 PM9/24/14
to puppet...@googlegroups.com
Hello Will/Felix,

Both of you were right. I upgraded my Puppet setup to 3.7.1, but no luck :(

Would request you guys to post me the link of puppet-labs repo ( 3.6.x ) . Im asking the link from you guys because i'v been racking my brains for days together behind this issue, so just wish to make sure that this time it works for me without any issues.

Thanks in Advance.
Justin..

Felix Frank

unread,
Sep 24, 2014, 8:29:08 PM9/24/14
to puppet...@googlegroups.com
On 09/24/2014 08:37 PM, Justin tim wrote:
> Hello Will/Felix,
>
> Both of you were right. I upgraded my Puppet setup to 3.7.1, but no
> luck :(
>
> Would request you guys to post me the link of puppet-labs repo ( 3.6.x
> ) . Im asking the link from you guys because i'v been racking my
> brains for days together behind this issue, so just wish to make sure
> that this time it works for me without any issues.
>
> Thanks in Advance.
> Justin..

Uhm. A downgrade to 3.6? Not sure how you would currently go about that,
to be honest.

Am I right to assume that this is an issue only on your master node?
Would you be willing to patch this manually? I could help you with
instructions to that effect.

Cheers,
Felix

Justin Timberlake

unread,
Sep 24, 2014, 10:34:54 PM9/24/14
to puppet...@googlegroups.com
Hi Felix,

I'l try to patch it, if you can paste the steps/instructions somewhere.

Thanks
Justin


Cheers,
Felix

--
You received this message because you are subscribed to a topic in the Google Groups "Puppet Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/puppet-users/g1sFQ9-HqzE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to puppet-users...@googlegroups.com.

Felix Frank

unread,
Sep 25, 2014, 10:48:32 AM9/25/14
to puppet...@googlegroups.com
On 09/25/2014 04:34 AM, Justin Timberlake wrote:
> Hi Felix,
>
> I'l try to patch it, if you can paste the steps/instructions somewhere.
>
> Thanks
> Justin

Hi,

no need, it's really simple.

1. locate the file `apply.rb` in your installation of Puppet (under
puppet/application/ in a Ruby library location).
2. Insert this line:
https://github.com/ffrank/puppet/commit/587062e1f157c3b6eb08242c99c747c24082d736#diff-3acace79a768858f1f8964ecdb582af2R201

This solution (or workaround?) has not yet been blessed by the dev team,
but it should get you running.

HTH,
Felix

Justin Timberlake

unread,
Sep 25, 2014, 1:09:35 PM9/25/14
to puppet...@googlegroups.com
Hey Felix,
 
Your are a puppet genius ... !!
 
Added the line "node.environment = apply_environment" in /usr/lib/ruby/site_ruby/1.8/puppet/application/apply.rb  and finally 'puppet apply' works :)
 
puppet:/etc/puppet/manifests # puppet apply user-absent.pp
Notice: Compiled catalog for puppet in environment production in 0.34 seconds
Notice: /Stage[main]/Main/User[newton]/ensure: created
Notice: Finished catalog run in 0.46 seconds

 

Cool ...!! Excellent..
 
Thank you for everything ..
 
Justin


Felix

--
You received this message because you are subscribed to a topic in the Google Groups "Puppet Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/puppet-users/g1sFQ9-HqzE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to puppet-users...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages