xkrantz
2013-Jan-18 13:56 UTC
[Puppet Users] Puppet 2.6 - Custom functions - environments issue
Hello every one, I have looked at a lots of threads in the Puppet User group but I did not find a clear answer or explanation how custom functions work.... Here is my current setup : * I have *2 "environments"*. working fine /etc/puppet/environments/production/ /etc/puppet/environments/test/ * I have a version of my function already working in production * According to the documentation, *"functions" are executed on puppet master Side*. So I put my *new version* into /var/lib/puppet/lib/puppet/parser/functions/myfunction.rb on the master. My new version is also present in /etc/puppet/*environments/test*/modules/mymodule/lib/puppet/parser/function/myfunction.rb and synced to the agent via "pluginsync" * When I run my puppet agent on my "test" environment, I get the expected behavior. So I merged my changes in the "production" environment. * Now when I run my agent on the "production" Environment, I get the behavior of the previous version of my function. If I run the agent right away against the "test" environment, I get again the expected behavior... I checked the files in both environment through md5sum and they are the same. And the /var/lib... on the master is also the same.... So, how exactly does it work ? More details : - Debian Squeeze - Puppet 2.6.2 - Apache + Passenger Front End Thanks a lot for your answers ! -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/ZWrXc2QQ5p8J. 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.
jcbollinger
2013-Jan-18 19:52 UTC
[Puppet Users] Re: Puppet 2.6 - Custom functions - environments issue
On Friday, January 18, 2013 7:56:20 AM UTC-6, xkrantz wrote:> > Hello every one, > > I have looked at a lots of threads in the Puppet User group but I did not > find a clear answer or explanation how custom functions work.... > Here is my current setup : > > > * I have *2 "environments"*. working fine > /etc/puppet/environments/production/ > /etc/puppet/environments/test/ > > * I have a version of my function already working in production > > * According to the documentation, *"functions" are executed on puppet > master Side*. > So I put my *new version* into > /var/lib/puppet/lib/puppet/parser/functions/myfunction.rb on the master. > My new version is also present in /etc/puppet/*environments/test*/modules/mymodule/lib/puppet/parser/function/myfunction.rb > and synced to the agent via "pluginsync" > > > * When I run my puppet agent on my "test" environment, I get the expected > behavior. > So I merged my changes in the "production" environment. > > * Now when I run my agent on the "production" Environment, I get the > behavior of the previous version of my function. > If I run the agent right away against the "test" environment, I get again > the expected behavior... > I checked the files in both environment through md5sum and they are the > same. > And the /var/lib... on the master is also the same.... > > > So, how exactly does it work ? > >Once Puppet loads a function implementation by processing its Ruby source file, I don''t think it will ever process that Ruby source again in the same run. Try restarting the master. John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/geEUS-d-7vUJ. 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.
xkrantz
2013-Jan-19 17:37 UTC
[Puppet Users] Re: Puppet 2.6 - Custom functions - environments issue
Le vendredi 18 janvier 2013 20:52:03 UTC+1, jcbollinger a écrit :> > > On Friday, January 18, 2013 7:56:20 AM UTC-6, xkrantz wrote: >> >> Hello every one, >> >> I have looked at a lots of threads in the Puppet User group but I did not >> find a clear answer or explanation how custom functions work.... >> Here is my current setup : >> >> >> * I have *2 "environments"*. working fine >> /etc/puppet/environments/production/ >> /etc/puppet/environments/test/ >> >> * I have a version of my function already working in production >> >> * According to the documentation, *"functions" are executed on puppet >> master Side*. >> So I put my *new version* into >> /var/lib/puppet/lib/puppet/parser/functions/myfunction.rb on the master. >> My new version is also present in /etc/puppet/*environments/test*/modules/mymodule/lib/puppet/parser/function/myfunction.rb >> and synced to the agent via "pluginsync" >> >> >> * When I run my puppet agent on my "test" environment, I get the expected >> behavior. >> So I merged my changes in the "production" environment. >> >> * Now when I run my agent on the "production" Environment, I get the >> behavior of the previous version of my function. >> If I run the agent right away against the "test" environment, I get again >> the expected behavior... >> I checked the files in both environment through md5sum and they are the >> same. >> And the /var/lib... on the master is also the same.... >> >> >> So, how exactly does it work ? >> >> > Once Puppet loads a function implementation by processing its Ruby source > file, I don''t think it will ever process that Ruby source again in the same > run. Try restarting the master. > > > John > >Hi John, Indeed, after a while (Passenger''s threads with puppet masterd process stopped and restarted), it was ok. But still, I have experienced different behaviors according to the "Environment" my puppet Agents were running against. So, does Puppet master load different versions of the function''s ruby files per environments ? Thanks again ! -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/9iOArm2QfVkJ. 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
2013-Jan-19 18:10 UTC
Re: [Puppet Users] Re: Puppet 2.6 - Custom functions - environments issue
On Sat, Jan 19, 2013 at 11:37 AM, xkrantz <xkrantz@viadeoteam.com> wrote:> Le vendredi 18 janvier 2013 20:52:03 UTC+1, jcbollinger a écrit : > > >> >> On Friday, January 18, 2013 7:56:20 AM UTC-6, xkrantz wrote: >>> >>> Hello every one, >>> >>> I have looked at a lots of threads in the Puppet User group but I did >>> not find a clear answer or explanation how custom functions work.... >>> Here is my current setup : >>> >>> >>> * I have *2 "environments"*. working fine >>> /etc/puppet/environments/**production/ >>> /etc/puppet/environments/test/ >>> >>> * I have a version of my function already working in production >>> >>> * According to the documentation, *"functions" are executed on puppet >>> master Side*. >>> So I put my *new version* into /var/lib/puppet/lib/puppet/**parser/functions/myfunction.rb >>> on the master. >>> My new version is also present in /etc/puppet/*environments/test*/** >>> modules/mymodule/lib/puppet/**parser/function/myfunction.rb and synced >>> to the agent via "pluginsync" >>> >>> >>> * When I run my puppet agent on my "test" environment, I get the >>> expected behavior. >>> So I merged my changes in the "production" environment. >>> >>> * Now when I run my agent on the "production" Environment, I get the >>> behavior of the previous version of my function. >>> If I run the agent right away against the "test" environment, I get >>> again the expected behavior... >>> I checked the files in both environment through md5sum and they are the >>> same. >>> And the /var/lib... on the master is also the same.... >>> >>> >>> So, how exactly does it work ? >>> >>> >> Once Puppet loads a function implementation by processing its Ruby source >> file, I don''t think it will ever process that Ruby source again in the same >> run. Try restarting the master. >> >> >> John >> >> > > Hi John, > > Indeed, after a while (Passenger''s threads with puppet masterd process > stopped and restarted), it was ok. > > But still, I have experienced different behaviors according to the > "Environment" my puppet Agents were running against. > So, does Puppet master load different versions of the function''s ruby > files per environments ? >The corollary from what John said is environments are lightweight methods for testing new manifests. Anything written in ruby such as functions should be tested and deployed in separate puppet master instances. Environments are not suitable as containers for running different ruby code or multi-tenancy. 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.
Reasonably Related Threads
- Custom ruby modules/classes, standard namespacing, pluginsync, etc.
- Multiple environments
- Problem syncing custom fact
- accessing a variable inside a plugin
- Warning: Local environment: "42A" doesn't match server specified node environment "production", switching agent to "production"