Puppet 2.6 - Custom functions - environments issue

78 views
Skip to first unread message

xkrantz

unread,
Jan 18, 2013, 8:56:20 AM1/18/13
to puppet...@googlegroups.com
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 !


jcbollinger

unread,
Jan 18, 2013, 2:52:03 PM1/18/13
to puppet...@googlegroups.com

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
 

xkrantz

unread,
Jan 19, 2013, 12:37:04 PM1/19/13
to puppet...@googlegroups.com
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 !


Nan Liu

unread,
Jan 19, 2013, 1:10:57 PM1/19/13
to puppet...@googlegroups.com
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 
Reply all
Reply to author
Forward
0 new messages