> Hm, does this work in case I have one keyattribute that is not "name"
> (like the fileresource where the keyattribute is "path")?

No, but neither does the existing code.  :(

> If not, here is a second suggestion
> 
>     def self.title_join(hash)
>       # extract all parameters that are keyattributes to build defaulttitle
>       passed_keyattributes = hash.values_at(*self.key_attributes)
>       if passed_keyattributes.include?(nil)
>         nil # or raise an error?
>       else
>         passed_keyattributes.join('/')
>       end
>     end
> 
> This way you only have to overwrite the method if you're unhappy with
> the default joiner "/".

The problem there is that the set of key attributes isn't really what
we're after.

Suppose our resources were coordinates and our patterns were:

    [[/#{num},#{num}/, [[:x,identity],[:y,identity]]],
     [/r:#{num} *theta:#{num}/, [[:r,identity],[:theta,identity]]]]

Depending on how we did things under the hood, we'd likely never get all
four key attributes at once, but if we ever did the generated name would
be order indeterminate gibberish.

For this and similar reasons I like Dan's "fail at design/testing time
if we can't infer it" approach better here.

-- Markus


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

Reply via email to