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",
>       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?
>
>

Multiple Exec resources may have the same command and/or title.  This is a 
hard-coded special case, and other types cannot emulate it.

No physical resource can be identified by an XPath expression alone.  Only 
in the context of an XML file does an XPath expression represent anything 
concrete, and the natural identifier of that thing (or things) is the 
combination of file and XPath expression.  Your type absolutely *begs* for 
a compound namevar.

With that said, I can't say I care for the rest of what I see about your 
type.  In particular, the presence of a 'command' attribute suggests that 
you are trying to model an action on some resource, instead of modeling the 
resource itself.  You probably can make that work, but it runs against 
Puppet's design and mode of operation, which may end up presenting 
practical problems.


John

-- 
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/727e781b-c151-4208-8ba3-d9c9c5cf7efa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to