Sriramu Singaram
2011-Apr-27 23:23 UTC
[Puppet Users] Is it necessary for site.pp to change in order to apply a new catalog?
Hi everyone, I am using Puppet 2.6.5 on my Master and Client. My /etc/puppet/manifests/site.pp looks like this: import "nodes/*" import "templates" import "nodes" I have a templates.pp file with a "class baseclass {...}" in it and nodes.pp file that looks like this: node ''default'' { include baseclass } The very first time when I start the puppet agent on the client it creates a certificate on the master and applies the catalog for the default node. I then have a script file on the master that creates a new catalog specific to the client node inside the nodes/ directory and executes a puppet kick to the client. The puppet kick finishes with status success and exit code 0 on the master. However when I look at the puppet logs on the client it doesnt seem to have picked up the new catalog at all and but says: triggered run Finished catalog in 3.02 seconds. It looked like it was only applying the cached catalog rather than the newly created one inside the nodes/ directory. This even after trying and executing puppet kick multiple times. So I then tried doing "touch site.pp" before doing puppet kick in my script file and then it seemed to pick my new catalog. Is there any reason for this behavior?...do we need to make sure that the site.pp file is changed everytime a new catalog is applied? Any help is greatly appreciated. Thanks, Sriramu -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Nan Liu
2011-Apr-28 16:11 UTC
Re: [Puppet Users] Is it necessary for site.pp to change in order to apply a new catalog?
On Wed, Apr 27, 2011 at 4:23 PM, Sriramu Singaram <sriramus.ipc@gmail.com> wrote:> Hi everyone, > > I am using Puppet 2.6.5 on my Master and Client. > > My /etc/puppet/manifests/site.pp looks like this: > > import "nodes/*" > import "templates" > import "nodes" > > I have a templates.pp file with a "class baseclass {...}" in it and > nodes.pp file that looks like this:Put it in a module, don''t ab^H^Huse import to load classes/defines. I would keep import to only files that contain node definition.> node ''default'' { > include baseclass > }Verify on the puppet master the manifests are working as expected first before you try client/server. Normally you should write a test manifest, but in this case since it''s in the default node, simply run puppet apply site.pp --noop to verify it''s detecting baseclass.> The very first time when I start the puppet agent on the client it > creates a certificate on the master and applies the catalog for the > default node. > > I then have a script file on the master that creates a new catalog > specific to the client node inside the nodes/ directory and executes a > puppet kick to the client. > > The puppet kick finishes with status success and exit code 0 on the > master. However when I look at the puppet logs on the client it doesnt > seem to have picked up the new catalog at all and but says: > > triggered run > Finished catalog in 3.02 seconds. > > It looked like it was only applying the cached catalog rather than the > newly created one inside the nodes/ directory. This even after trying > and executing puppet kick multiple times. > > So I then tried doing "touch site.pp" before doing puppet kick in my > script file and then it seemed to pick my new catalog.You should not need to do that. There''s a buggy behavior on passenger where you may need to run puppet agent twice: http://projects.puppetlabs.com/issues/5318> Is there any reason for this behavior?...do we need to make sure that > the site.pp file is changed everytime a new catalog is applied?No, puppet will auto detect changes to puppet manifests and compile a new catalog. Thanks, Nan -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Sriramu Singaram
2011-Apr-28 18:04 UTC
[Puppet Users] Re: Is it necessary for site.pp to change in order to apply a new catalog?
On Apr 28, 9:11 am, Nan Liu <n...@puppetlabs.com> wrote:> On Wed, Apr 27, 2011 at 4:23 PM, Sriramu Singaram > > <sriramus....@gmail.com> wrote: > > Hi everyone, > > > I am using Puppet 2.6.5 on my Master and Client. > > > My /etc/puppet/manifests/site.pp looks like this: > > > import "nodes/*" > > import "templates" > > import "nodes" > > > I have a templates.pp file with a "class baseclass {...}" in it and > > nodes.pp file that looks like this: > > Put it in a module, don''t ab^H^Huse import to load classes/defines. I > would keep import to only files that contain node definition. > > > node ''default'' { > > include baseclass > > } > > Verify on the puppet master the manifests are working as expected > first before you try client/server. Normally you should write a test > manifest, but in this case since it''s in the default node, simply run > puppet apply site.pp --noop to verify it''s detecting baseclass. > > > > > The very first time when I start the puppet agent on the client it > > creates a certificate on the master and applies the catalog for the > > default node. > > > I then have a script file on the master that creates a new catalog > > specific to the client node inside the nodes/ directory and executes a > > puppet kick to the client. > > > The puppet kick finishes with status success and exit code 0 on the > > master. However when I look at the puppet logs on the client it doesnt > > seem to have picked up the new catalog at all and but says: > > > triggered run > > Finished catalog in 3.02 seconds. > > > It looked like it was only applying the cached catalog rather than the > > newly created one inside the nodes/ directory. This even after trying > > and executing puppet kick multiple times. > > > So I then tried doing "touch site.pp" before doing puppet kick in my > > script file and then it seemed to pick my new catalog. > > You should not need to do that. There''s a buggy behavior on passenger > where you may need to run puppet agent twice:http://projects.puppetlabs.com/issues/5318 > > > Is there any reason for this behavior?...do we need to make sure that > > the site.pp file is changed everytime a new catalog is applied? > > No, puppet will auto detect changes to puppet manifests and compile a > new catalog.by "puppet manifests" do you mean the central site.pp file or the entire collection of node definitions inside /etc/puppet/manifests/ because the only change that happens after the successful previous catalog run is me creating a new node definition file inside the /etc/ puppet/manifests/nodes/ directory, I do not make any changes to the site.pp file. I seem to observe quite often (not always though) that puppet seems oblivious to the new node definition file that has just been created unless I touch or change the site.pp file, which I think alerts puppet to a change in cached catalog or something. Thanks, Sriramu -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Eric Searcy
2011-May-02 22:22 UTC
Re: [Puppet Users] Is it necessary for site.pp to change in order to apply a new catalog?
>> So I then tried doing "touch site.pp" before doing puppet kick in my >> script file and then it seemed to pick my new catalog. > > You should not need to do that. There''s a buggy behavior on passenger > where you may need to run puppet agent twice: > http://projects.puppetlabs.com/issues/5318This is unrelated to that bug, I''ve been having to do this since before I switched from webrick to passenger. I have: site.pp: import ''nodes'' [other stuff...] nodes.pp: import ''nodes/*'' The wildcard is evaluated when the nodes.pp file is compiled. It doesn''t get compiled until the mtime changes (unlike the above bug which goes away on its own). Adding new files to the nodes/ directory won''t affect mtime of nodes.pp ... so I have a hook in my version control on the puppet master so that nodes.pp is touched each time the repo is updated to a new commit. (I realize separating the wildcard import out of site.pp isn''t really doing much, I just wanted to isolate this weird behavior and workaround into its own file). Once upon a time I think I saw a reference to this behavior in the puppet documentation but I can''t find it any more ... maybe older version of the Language Guide, or maybe I saw it on the mailing list. -Eric -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.