Search code examples
chef-infrachef-solo

Difference between current_resource and new resource in opscode chef


What is the purpose of current_resource and new_resource in opscode chef. Where exactly to use them in libraries. Difference between them.

Thanks,


Solution

  • Within the context of a provider, new_resource is the actual resource object from the recipe meaning it contains the desired state of whatever the resource is describing. current_resource is populated from load_current_resource and generally contains the current state of the thing on the current system, such as the current installed version of a package or current contents of a file.