Hi, Since functions run on the Puppet Master side, the simplest solution is to cache the value if its "freshness" is not mandatory i.e. does not change, lets say every 5 minutes? Or, even it will be fine every 24 hours, etc ...
Consider this snippet: https://gist.github.com/3680388 Let me know if you have troubles adapting this for your function, I am always keen to help :) KW On Saturday, September 8, 2012 4:59:31 PM UTC+1, JeremyCampbell wrote: > > Hey, > > I'm using Puppet 2.7.19 with hiera 0.3.0. I have an Openvpn module which > has a custom function that queries a mysql db and returns a hash. I also > need the hash values in other modules e.g. firewall module. Since the > custom function is in the openvpn/lib/puppet/parser/functions folder I > believe it is autoloaded and is available from other modules. However, I > don't want to have to call the custom function multiple times as it's an > expensive mysql query. What would be the best way to call the custom > function once and make the returned hash available to other modules? > > Thanks for your time! > > Cheers, > J. > > -- 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/-/BCancuZNchMJ. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
