On Jun 23, 2011, at 11:08 AM, Carl Caum wrote: > > On Jun 22, 2011, at 10:55 PM, Luke Kanies wrote: > >> On Jun 22, 2011, at 6:05 PM, Carl Caum wrote: >> >>> I'm not clear at all on how to do prefetching in custom providers. Can >>> someone shed some light? Perhaps point to very detailed documentation with >>> example code? >>> >>> A few questions right off the bat: >>> >>> 1) Is @property_hash a convention or implementation? If implementation, do >>> I structure it a certain way to get certain behavior from puppet? >> >> It's convention, and one I've always been a bit embarrassed by. >> >>> 2) If I prefetch, do I still need to have getter methods for properties? >> >> Um, I *think* you don't need them any more. That is, I'm confident normal >> puppet usage doesn't require them, but I'm not sure if things like ralsh use >> requires them. Maybe try 'ralsh <mytype>' and 'ralsh <mytype> <name>' as >> tests? > > Looks like I still need getter methods for ralsh. Also, I need to implement > self.instances. > >> >>> 3) Does my prefetch methods have to accept a hash of properties from the >>> manifest? What am I supposed to do with it? >> >> Hash of properties? >> >> I'm pretty sure they have to accept a hash of resources, and set the >> provider instance on each resource. > > Err, I meant resources. Digging through the code, it looks like prefetch > doesn't have to take in a hash of resources. I can instead call instances > and iterate through that list, modifying the resource as necessary. I > haven't gotten far enough to see if that allows me to know if a provided > resource is insync though.
Hmm. I wouldn't recommend that - normall, 'instances' calls prefetch, so if prefetch also calls instances... bad things will likely result. -- Computers are not intelligent. They only think they are. --------------------------------------------------------------------- Luke Kanies -|- http://puppetlabs.com -|- http://about.me/lak -- You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to [email protected]. 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.
