On Tue, Jun 14, 2011 at 02:59:06PM -0700, Nan Liu wrote:
> On Tue, Jun 14, 2011 at 2:30 PM, Dominik Zyla <dominik.z...@gmail.com> wrote:
> > On Tue, Jun 14, 2011 at 02:04:33PM -0700, Nan Liu wrote:
> >> On Tue, Jun 14, 2011 at 1:40 PM, Dominik Zyla <dominik.z...@gmail.com> 
> >> wrote:
> >> > Hello group,
> >> >
> >> > I'm trying to generate configuration for tomcat server. I want it to
> >> > depend on my mod_jk properties file. I wrote some simple script which
> >> > you can see here: http://pastebin.com/CffBr0Nc it works just fine.
> >> >
> >> > So I tried to move it to puppet as my custom function. It's available
> >> > for review here: http://pastebin.com/AeQgTTT6
> >> >
> >> > Now, when I'm running first in irb, I see that script loads
> >> > properties file and instance() function returns "node_#{l}" which is
> >> > `node_SOME_LETTER' and that's exactly what I want it to do.
> >> >
> >> > But as long as I'm running irb against puppet file, I see there's no
> >> > data loaded into `filename' hash. When I run `puppetd -tv' on client,
> >> > I've got timeout (after 120 seconds which is default), but puppet master
> >> > is still running (spawned by passanger) until it got killed by
> >> > oom-killer.
> >> >
> >> > Please, give me some hints what am I doing wrong.
> >>
> >> Puppet functions examples:
> >> http://projects.puppetlabs.com/projects/1/wiki/Writing_Your_Own_Functions
> >
> > I read this so far.
> >
> >> You should be doing something along the lines of:
> >> module Puppet::Parser::Functions
> >>   newfunction(:instance, :type=> :rvalue) do |args|
> >>     letters = args[0]
> >>     hosts = args[1]
> >>     ports = args[2]
> >>   ...
> >>   end
> >> end
> >
> > The problem is that I don't know values of hosts and ports and what I'm
> > trying to do is to determine this values depending on properties file
> > (it's similar to Java properties file).
> 
> Sorry, I thought it needed to pass the value for the function, if it's
> expected to return the value I took a closer look and used a sample
> tomcat worker.properties file, is this what you intend?
> http://pastebin.com/kcwm7ZnV
> 
> Thanks,

It works now. Thanks a lot, Nan. Now I understand much more about
writing custom functions and tomorrow I'll test it out. Once again
thanks.

Regards, 
-- 
Dominik Zyla

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to