[Puppet Users] Re: Allowing duplicate namevars in custom types

2015-02-13 Thread jwilkicki
There's a lot of great design advice in here. Thank you for taking the time to write it up; I'll definitely do a deeper dive on this when I've solved my immediate problem and check this advice against some of the other rules I've written. I often find Puppet to be as much of a mind-bender as w

[Puppet Users] Re: Allowing duplicate namevars in custom types

2015-02-13 Thread jcbollinger
On Thursday, February 12, 2015 at 1:53:25 PM UTC-6, jwil...@gmail.com wrote: > > Well, I was thinking of doing a type similar to what xmlstarlet does, > including being able to add and remove nodes. I don't really need the > added behavior of adding and removing nodes from the file right now,

[Puppet Users] Re: Allowing duplicate namevars in custom types

2015-02-12 Thread jwilkicki
Well, I was thinking of doing a type similar to what xmlstarlet does, including being able to add and remove nodes. I don't really need the added behavior of adding and removing nodes from the file right now, so I left command as a future expansion parameter, but it basically only accepts 'rep

[Puppet Users] Re: Allowing duplicate namevars in custom types

2015-02-12 Thread jcbollinger
On Wednesday, February 11, 2015 at 11:09:32 AM UTC-6, jwil...@gmail.com wrote: > > Hi all! > > I'm working on a custom type that applies xpaths to files. I expect the > interface to look something like: > > xpath { "some update": > xpath => "/some/xpath", > command => "replace", >

[Puppet Users] Re: Allowing duplicate namevars in custom types

2015-02-12 Thread jwilkicki
I did try to do that for another type I wrote and it was a mess. I ended up having a single namevar that required a particular format that my type then processed to get the parameters I needed. I'll take a look at your example; I'm sure I'll learn something from it. Maybe it's worth another

[Puppet Users] Re: Allowing duplicate namevars in custom types

2015-02-12 Thread Raphink
If more than one parameter make sense for a namevar, then you can use composite namevars, by using `isnamevar` for sevaral parameters and adding a `self.title_patterns` method to define how to parse the title and feed the namevar parameters. See https://github.com/hercules-team/augeasproviders