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 
stab.

In the meantime, I based my new type on the regular augeas type and the 
exec type and will see if I hit a problem with duplicate namevars.

On Thursday, February 12, 2015 at 8:15:56 AM UTC-5, Raphink wrote:
>
> 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_postgresql/blob/master/lib/puppet/type/pg_hba.rb
>  
> for an example.
>
>
>
>
> On Wednesday, February 11, 2015 at 6:09:32 PM UTC+1, 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",
>>       value => "newvalue",
>>       file => "/path/to/file.xml"
>> }
>>
>> I'm having a little trouble picking the namevar.  It seems logical that 
>> the xpath attribute should be the namevar, but I'm a little hung up on the 
>> fact that it has to be unique among all xpath resources.  In theory, I 
>> might want to apply the same xpath to many different files but with 
>> different values.  I ran across a mention in the documentation that the 
>> exec type allows duplicate namevars, but going through the implementation, 
>> it isn't clear to me how that is done.  Is it just a matter of each exec 
>> declaration having a unique title but the same command?
>>
>> Thanks for the help!
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/5742b030-9988-4985-b8be-a65b370e2f46%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to