On Nov 18, 2008, at 11:54 PM, Nigel Kersten wrote: > > On Tue, Nov 18, 2008 at 9:20 PM, Luke Kanies <[EMAIL PROTECTED]> wrote: >> >> On Nov 18, 2008, at 11:15 PM, Nigel Kersten wrote: >> >>> >>> how do you autorequire within a provider? >>> >>> or is that the wrong place and you should do it in the type? >> >> You can currently only autorequire from a type. For now, just add a >> hook to your type that checks to see if the provider supports >> autorequire, and if so returns its results. Something like this: >> >> autorequire(:stuff) do >> if provider.respond_to?(:autorequire) >> provider.autorequire(:stuff) >> else >> [] >> end >> end > > Would it make more sense to define this in type.rb than in a specific > service type? > > That would seem more sensible if I'm understanding all the inheritance > correctly?
Yeah, that's kind of what I was suggesting. >> I *think* that using 'return' here will behave wonkily (because of >> how >> Ruby doesn't like 'return' in blocks). >> >> This is something Andrew is constantly dinging me on -- how to >> provide >> transparent access to the provider. I'm amenable to providing >> something like this automatically. The transaction could be extended >> to look for autorequires on the provider like it does on the type. > > It seems to make sense to make it as transparent as possible to me. Is > doing it on the provider significantly more work than doing it in the > type? It's not that it's more work; it's just that 1) providers are relatively new, compared to the transaction, and 2) I've traditionally tried to hide the provider from outside the resource type. I'm not saying they're the right move, but that's what I've done. -- No one who cannot rejoice in the discovery of his own mistakes deserves to be called a scholar. --Donald Foster --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en -~----------~----~----~----~------~----~------~--~---