Class Chef::Client
In: lib/chef/client.rb
Parent: Object

Chef::Client

The main object in a Chef run. Preps a Chef::Node and Chef::RunContext, syncs cookbooks if necessary, and triggers convergence.

Methods

Included Modules

Chef::Mixin::PathSanity

Attributes

json_attribs  [R] 
node  [RW] 
ohai  [RW] 
rest  [RW] 
run_status  [R] 
runner  [RW] 

Public Class methods

Clears all notifications for client run status events. Primarily for testing purposes.

The list of notifications to be run when the client run completes successfully.

The list of notifications to be run when the client run fails.

The list of notifications to be run when the client run starts.

Add a notification for the ‘client run success’ event. The notification is provided as a block. The current Chef::RunStatus object will be passed to the notification_block when the event is triggered.

Add a notification for the ‘client run failed’ event. The notification is provided as a block. The current Chef::RunStatus is passed to the notification_block when the event is triggered.

Add a notification for the ‘client run started’ event. The notification is provided as a block. The current Chef::RunStatus object will be passed to the notification_block when the event is triggered.

Public Instance methods

Applies environment, external JSON attributes, and override run list to the node, Then expands the run_list.

Returns

node<Chef::Node>:The modified @node object. @node is modified in place.

Converges the node.

Returns

true:Always returns true

In client-server operation, loads the node state from the server. In chef-solo operation, builds a new node object.

Do a full run for this Chef::Client. Calls:

  • do_run

This provides a wrapper around do_run allowing the run to be optionally forked.

Returns

boolean:Return value from do_run. Should always returns true.

Callback to fire notifications that the run completed successfully

Callback to fire notifications that the Chef run failed

Callback to fire notifications that the Chef run is starting

 Configures the Chef::Cookbook::FileVendor class to fetch file from the
 server or disk as appropriate, creates the run context for this run, and
 sanity checks the cookbook collection.

Returns

 Chef::RunContext:: the run context for this run.

Sync_cookbooks eagerly loads all files except files and templates. It returns the cookbook_hash — the return result from /environments/#{node.chef_environment}/cookbook_versions, which we will use for our run_context.

Returns

Hash:The hash of cookbooks with download URLs as given by the server

[Validate]