Hi Mark, I'd echo AJ's suggestion about moving the functionality into LWRPs. They're not hard to set up, and this approach gives you complete _expression_ within Ruby, taking place at convergence time. One frustration I have with Chef (others are free to concur or explain how to get past it) is that there isn't a very rich transfer of information back from a resource when it converges. You can pass attribute values in to the resource but you basically get to transfer just two bits back: either success or failure, or a change to the resource which can be used to trigger a notify action. (Or you can throw an exception, but then you can't specify where to catch it, so it's not really usable as a means of flow control.) What this means in terms of algorithm design is that once you're working within an LWRP, you try to complete the task there as much as possible. If your main concern is to manage some API calls, that's easy. It gets a bit trickier if you then want to conditionally trigger other resources within a Chef recipe depending on what comes back from those calls, but if you can reduce that to one or two bits of information then it's possible. Is your templated response file serving as a channel to communicate additional information between Chef resources? It seems like you only care whether or not it's changed, which is one bit. In that case, it might be more elegant to use notifications instead. Cheers, Dan On 13-05-09 02:52 PM, Mark Pimentel wrote: " type="cite"> |
Archive powered by MHonArc 2.6.16.