On Fri, Mar 04, 2011 at 05:08:05PM -0500, Trevor Vaughan wrote:
> Thanks for the example! That was exactly what I was looking for.
> 
> Also, thanks for the bug list since I would have run into them.
> 
> Is title_patterns an override that must be called? What's the
> difference between this and just munging in each of the parameters?

Yes you have to overwrite title_patterns if you use more than one
isnamevar (have a look in type.rb). The title_pattern decides what will
happen with the title. If you have one namevar the title will just set
that single namevar. If you have more than one namevar puppet doesnt know
what to do with the title thus the need to overwrite the title_patterns
method

The title_pattern method is used in resource.rb in the parse_title
method. It will expect that you return an (not really intuitive) array
of the form

[ [ regex1, ARRAY ], [ regex2, ARRAY ] ]

with ARRAY = [ [:namevar1, proc_that_is_called_with_namevar1], ... ,[:namevarN, 
proc ] ]

In you example your title_pattern method could return
[ [ /^(.*):(.*)$/, [ [ :target, lambda{|x| x} ], [:username, lambda{|x| x}] ] ] 
]

> Thanks,
> 
> Trevor

-Stefan

Attachment: pgpad0FmcUw2Y.pgp
Description: PGP signature

Reply via email to