Skip to content

Instantly share code, notes, and snippets.

@rberger
Created November 30, 2009 00:43
Show Gist options
  • Save rberger/245168 to your computer and use it in GitHub Desktop.
Save rberger/245168 to your computer and use it in GitHub Desktop.
http://wiki.opscode.com/display/chef/Light-weight+Resources+and+Providers+%28LWRP%2
Providers
Background
A chef-client run has two stages:
the compilation phase, in which the client examines each Recipe in order and adds its Resources to the ResourceCollection
the ResourceCollection execution phase, in which the client iterates over the ResourceCollection and performs the following:
Based on the Resource's "provider" attribute, a new instance of the specified Provider is created (if the attribute is not set, one is selected based on the local platform). The originating Resource is stored in the new Provider as the @new_resource instance variable.
The load_current_resource method is then called on the provider instance, giving it an opportunity to populate @current_resource with a new resource that represents the current state of the relevant part of the system.
For each action specified in @new_resource.actions, the action_ method that corresponds to each action is called (e.g. action :create will invoke the action_create method of the Provider instance.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment