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, [email protected] 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/058c8dfd-515b-4251-9b4a-74c4880411cd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to