[chef] Why does chef have a two-pass execution flow?


Chronological Thread 
  • From: Ian MacLeod < >
  • To: " " < >
  • Subject: [chef] Why does chef have a two-pass execution flow?
  • Date: Mon, 28 Jan 2013 21:16:24 -0500
  • Accept-language: en-US
  • Acceptlanguage: en-US

Sorry if this is (most likely) a repost; I wasn't able to find any dupes in the list archive, though :(

Chef executes recipes with a two pass model: First it compiles each resource/provider by walking through the run list.  Then it converges each of the compiled resource/providers to get the host to the desired state.

While I (finally) understand how it works; I don't understand the why.  It seems like there are quite a few pitfalls w/ this model:

* It is very easy to execute tasks out of order by accidentally defining work outside of a resource (forgetting to use execute/ruby_block providers, dropping to lower level Ruby, etc)

* LWRPs that declare inline resources have a confusingly different execution order (their actions occur in the convergence phase, but any resources they declare get run after the current provider)

* It is not very obvious to newcomers; they seem to expect that recipes are executed immediately.

What are the benefits of this two pass architecture?  Why was Chef built this way?  (I'm not finding obvious docs on it)

Thanks,
-Ian




Archive powered by MHonArc 2.6.16.

§