FAQ
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.

Search Discussions

  • Jcbollinger at Jan 18, 2013 at 7:52 pm

    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 at Jan 19, 2013 at 5:37 pm
    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 at Jan 19, 2013 at 6:11 pm

    On Sat, Jan 19, 2013 at 11:37 AM, xkrantz 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.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppuppet-users @
categoriespuppet
postedJan 18, '13 at 1:56p
activeJan 19, '13 at 6:11p
posts4
users3
websitepuppetlabs.com

3 users in discussion

Xkrantz: 2 posts Jcbollinger: 1 post Nan Liu: 1 post

People

Translate

site design / logo © 2022 Grokbase