Re: [Puppet-dev] Composite namevar

2011-03-07 Thread Markus Roberts
Trevor -- Thanks for the extended explanation. This is something that should be > stuck up on the Type dev wiki. > > I'll try to get around to it, but no promises :-/. > At the point it was introduced (2.6.0) I believe we held back on publicly documenting it because 1) it might be forced to chang

Re: [Puppet-dev] Composite namevar

2011-03-07 Thread Trevor Vaughan
Markus, Thanks for the extended explanation. This is something that should be stuck up on the Type dev wiki. I'll try to get around to it, but no promises :-/. Thanks, Trevor On Fri, Mar 4, 2011 at 7:07 PM, Markus Roberts wrote: > > >> >> The title_pattern method is used in resource.rb in the

Re: [Puppet-dev] Composite namevar

2011-03-04 Thread Markus Roberts
> 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 ] ] > >

Re: [Puppet-dev] Composite namevar

2011-03-04 Thread Stefan Schulte
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 ju

Re: [Puppet-dev] Composite namevar

2011-03-04 Thread Trevor Vaughan
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? Thanks, Trevor On Fri, Mar 4, 2011

Re: [Puppet-dev] Composite namevar

2011-03-04 Thread Stefan Schulte
On Fri, Mar 04, 2011 at 01:46:54PM -0500, Trevor Vaughan wrote: > Is it possible to create a composite namevar when creating a custom type? > > Say you have an /etc/passwd like file that could exist at multiple locations. > > The actual unique set of variables is the target path of the file > com

Re: [Puppet-dev] Composite namevar

2011-03-04 Thread Trevor Vaughan
Yeah, using the path:username is fine but a big fugly. What I'd like is this: foo { "meaningless_name": target => "/some/path", username => "username" } Then, in foo.rb, I'd like to be able to say: :namevar = "#{target}:#{username} This would effectively throw away 'meaningless_name' and a

Re: [Puppet-dev] Composite namevar

2011-03-04 Thread Markus Roberts
Trevor -- It should be. The way to do it would be to set up a naming scheme that let the key fields be inferred from the title (e.g. something like "username in path" or the "path:username" that you gave as an example) with a regular expression to parse them (e.g. /^([a-zA-Z_0-9+) in (.+)$/ or /^

[Puppet-dev] Composite namevar

2011-03-04 Thread Trevor Vaughan
Is it possible to create a composite namevar when creating a custom type? Say you have an /etc/passwd like file that could exist at multiple locations. The actual unique set of variables is the target path of the file combined with the username. I'm trying to avoid something like: foo { "/some/