chef

https://github.com/opscode/chef

Ruby

A systems integration framework, built to bring the benefits of configuration management to your entire infrastructure.

Chef::Client#run

Do a full run for this Chef::Client.

Locks the run while doing its job.

Fires run_start before doing anything and fires run_completed or
run_failed when finished.  Also notifies client listeners of run_started
at the beginning of Compile, and run_completed_successfully or run_failed
when all is complete.

Phase 1: Setup
--------------
Gets information about the system and the run we are doing.

1. Run ohai to collect system information.
2. Register / connect to the Chef server (unless in solo mode).
3. Retrieve the node (or create a new one).
4. Merge in json_attribs, Chef::Config.environment, and override_run_list.

Phase 2: Compile
----------------
Decides *what* we plan to converge by compiling recipes.

1. Sync required cookbooks to the local cache.
2. Load libraries from all cookbooks.
3. Load attributes from all cookbooks.
4. Load LWRPs from all cookbooks.
5. Load resource definitions from all cookbooks.
6. Load recipes in the run list.
7. Load recipes from the command line.

Phase 3: Converge
-----------------
Brings the system up to date.

1. Converge the resources built from recipes in Phase 2.
2. Save the node.
3. Reboot if we were asked to.

Phase 4: Audit
--------------
Runs 'control_group' audits in recipes.  This entire section can be enabled or disabled with config.

1. 'control_group' DSL collects audits during Phase 2
2. Audits are run using RSpec
3. Errors are collected and reported using the formatters

Source | Google | Stack overflow

Edit

git clone [email protected]:opscode/chef.git

cd chef

open lib/chef/client.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Chef--Client-run-for-pr


# Commit to git

git add lib/chef/client.rbgit commit -m "better docs for Chef::Client#run"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-Chef--Client-run-for-pr

hub pull-request


# Celebrate!