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

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

Builds a new node object for this client. Starts with querying for the FQDN of the current host (unless it is supplied), then merges in the facts from Ohai.

Returns

node<Chef::Node>:Returns the created node object, also stored in @node

Converges the node.

Returns

true:Always returns true

Returns

rest<Chef::REST>:returns Chef::REST connection object

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

 * run_ohai - Collect information about the system
 * build_node - Get the last known state, merge with local changes
 * register - If not in solo mode, make sure the server knows about this client
 * sync_cookbooks - If not in solo mode, populate the local cache with the node's cookbooks
 * converge - Bring this system up to date

Returns

true: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

Synchronizes all the cookbooks from the chef-server.

Returns

true:Always returns true

[Validate]