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 at 4:56 PM, Stefan Schulte <stefan.schu...@taunusstein.net> wrote: > 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 >> combined with the username. >> >> I'm trying to avoid something like: >> >> foo { "/some/crazy/path:username": ..... } >> >> Any suggestions? >> >> Thanks, >> >> Trevor >> >> -- > > Yes it is possible to have a composite namevar. But there are a few bugs > in the current codebase that I noticed while writing a type to handle > entries in /etc/services (you can have telnet/udp and telnet/tcp for > example). They are documented in http://projects.puppetlabs.com/issues/5660 > > The title however has to be unique because you need a way to reference > a resource when declaring dependencies. But the title can implicitly set > multiple namevars. So > > foo { "/some/crazy/path:username": ...} > > can set path to "/some/crazy/path" and username to "username". All you > need to do here is > > a) use isnamevar multiple times > b) define a classmethod called title_patterns that can split the title > in multiple namevars > > example: > https://github.com/stschulte/puppet/blob/54ab7f7268fb9d39626057e6e023683ee5ae3f66/lib/puppet/type/port.rb > > -Stefan > -- Trevor Vaughan Vice President, Onyx Point, Inc (410) 541-6699 tvaug...@onyxpoint.com -- This account not approved for unencrypted proprietary information -- -- You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to puppet-dev@googlegroups.com. To unsubscribe from this group, send email to puppet-dev+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.