Skip to content

Notifications in Custom Chef Resources

2013 November 11
by Nayan Hajratwala

I was working with a Chef recipe, when I noticed that the notifies attribute for one of my providers didn’t seem to be working.

After some hair pulling, I realized that it was a Custom Provider, and more specifically, a Custom Lightweight Resource (LWRP).

As it turns out, if you actually RTFM, then you’ll find this little nugget:

To ensure that an embedded lightweight resource can notify the top-level resource add use_inline_resources to the top of the file that defines the lightweight provider that is associated with that lightweight resource.

As such, I modified my provider thusly:


require 'net/http'
require 'uri'

use_inline_resources

action :create do
...
end

Problem solved.