Cache data to be available to different puppet clients

20 views
Skip to first unread message

Sunil_mlec

unread,
Oct 11, 2009, 3:06:54 AM10/11/09
to Puppet Developers
Hi,
I m trying to cache some data which will be generated dynamically by
the puppetmaster. Basically, the data will be generated by the
puppetmaster based on a client query. Further if the same query comes
from a different puppet client, then the cached result should be
returned. But, till now I am not going in the right direction. Any
example, would be doing a great favor to me. Could you please help me
here?

Thanks in advance.

Ohad Levy

unread,
Oct 11, 2009, 6:07:41 AM10/11/09
to puppe...@googlegroups.com

Sunil_mlec

unread,
Oct 12, 2009, 2:17:35 AM10/12/09
to Puppet Developers
Thanks Ohad. You have done me a great favour.
I have one more question. Instead of storing the result in a local
file, can we use some variable (a hash or an array) to store the
results.

Thanks,
Sunil.
> > Thanks in advance.- Hide quoted text -
>
> - Show quoted text -

Ohad Levy

unread,
Oct 12, 2009, 2:25:57 AM10/12/09
to puppe...@googlegroups.com
Sunil, You can store it where ever you like :)

do you mean inside a puppet variable? or just in memory?
if you mean for puppet variable,  your function value should be stored some where - e.g.

$myvar = myfunction()

than $myvar would contain the value of your function.

if you mean that you want to store it in memory some where, I would guess your best using something like memcache for this job.

cheers,
Ohad

Sunil_mlec

unread,
Oct 12, 2009, 4:45:45 AM10/12/09
to Puppet Developers
In the case of $myvar = myfunction(), will the value in $myvar be
available to another client without calling myfunction()?

Thanks,
Sunil.
> > > - Show quoted text -- Hide quoted text -

Ohad Levy

unread,
Oct 12, 2009, 4:58:18 AM10/12/09
to puppe...@googlegroups.com
No, you would always need to call the function.

Sunil_mlec

unread,
Oct 12, 2009, 5:17:07 AM10/12/09
to Puppet Developers
Yeah, the function call is what I wanted to avoid.
So, Is there any other way by which we can get the $myvar (as per
above example) to be available to different puppet clients (without
using memcache)?

Thanks for your patience.

Peter Meier

unread,
Oct 12, 2009, 5:23:16 AM10/12/09
to puppe...@googlegroups.com
> Yeah, the function call is what I wanted to avoid.
> So, Is there any other way by which we can get the $myvar (as per
> above example) to be available to different puppet clients (without
> using memcache)?

then simply provide the data with an external node tool. People on
puppet-users might be able to help you on that.

cheers pete

Luke Kanies

unread,
Oct 12, 2009, 1:29:43 PM10/12/09
to puppe...@googlegroups.com
At this point the only way to do that would be by modifying the
internals of the system a bit more than is supported. You could just
have a single function call in the site.pp file, outside of any node/
class, and it could set/retrieve the cached value. That should be
trivial.
--
America believes in education: the average professor earns more money
in a year than a professional athlete earns in a whole week.
-- Evan Esar
---------------------------------------------------------------------
Luke Kanies | http://reductivelabs.com | http://madstop.com

Reply all
Reply to author
Forward
0 new messages