[chef] Re: Re: Re: ruby_block documentation wrong; how to set up a RunContext?


Chronological Thread 
  • From: Daniel DeLeo < >
  • To:
  • Subject: [chef] Re: Re: Re: ruby_block documentation wrong; how to set up a RunContext?
  • Date: Wed, 25 Sep 2013 12:03:16 -0700


On Wednesday, September 25, 2013 at 11:48 AM, Brian Hatfield wrote:

Thank you for you response!

Is it reasonable to just nil the events dispatcher out? I'm struggling to understand what it does in a concrete manner - I'd be delighted to RTFM if there's some overview documentation about how I interact with it somewhere that I cannot find.
The event dispatcher provides callbacks for all manner of events that happen in a Chef run, and the formatter output is built on top of this API. If you pass the existing event dispatcher in to a new run context, you'll get formatted output about what happens in the nested Chef run.

Event dispatch code inherits from this base class: https://github.com/opscode/chef/blob/master/lib/chef/event_dispatch/base.rb which is well commented.

The main dispatcher you pass around is one of these: https://github.com/opscode/chef/blob/master/lib/chef/event_dispatch/dispatcher.rb which implements a heavily simplified publish subscribe pattern to publish data generated by Chef to various event handling implementations (like formatters).
 

If I wanted to just use an existing events dispatcher during a run, how would I access it? Is that even a reasonable question, or should I be making a new one if I am making a new run context?
RunContext#events (from the outer run context) will give you the existing one.
 

Thanks again,
Brian



-- 
Daniel DeLeo




Archive powered by MHonArc 2.6.16.

§