On Wed, Nov 19, 2008 at 6:17 AM, Luke Kanies <[EMAIL PROTECTED]> wrote:
>> 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. ok, so I think I have most of it working, I'm just not quite sure how to specify the File resource to be returned. I've tried to make this as generic as possible. type.rb already has an autorequire method that checks class autorequires, so I'm adding the provider autorequires there. self.class.suitableprovider.each do |provider| if provider.respond_to?(:autorequire) provider.autorequire(self).each do |req| Puppet.notice("got an autorequire of: #{req}") end end end Obviously I'm not doing anything with it yet, but it will get appended to the existing array of requirements. I have two questions: a) Should I be passing "self" to the provider autorequire method? I need some way for the provider in its own autorequire method to know what resource it needs to build the autorequire list for, and this works, but I'm not sure if it is consistent with the rest of the Puppet code. b) On the other side in my provider, once I have the resource name, and thus can work out what files it should autorequire, how do I build a File resource to return back based upon the path(s) ? from my provider: def self.autorequire(resource) Puppet.notice("provider.self.autorequire: resource: #{resource[:name]}") job_path, job_plist = self.plist_from_label(resource[:name]) Puppet.notice("provider.self.autorequire: path: #{job_path}") # how do I return an array of required file resources at this point? [] end --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---