Skip to main content

LogResourceNotifications

All Cookstyle Cops


The department is: Chef/Deprecations

The full name of the cop is: Chef/Deprecations/LogResourceNotifications


Enabled by defaultSupports autocorrectionTarget Chef Version
EnabledNo15.8+

In Chef Infra Client 16 the log resource no longer notifies when logging so notifications should not be triggered from log resources. Use the notify_group resource introduced in Chef Infra Client 15.8 instead to aggregate notifications.

Examples

incorrect

template '/etc/foo' do
  source 'bar.erb'
  notifies :write, 'log[Aggregate notifications using a single log resource]', :immediately
end

log 'Aggregate notifications using a single log resource' do
  notifies :restart, 'service[foo]', :delayed
end

correct

template '/etc/foo' do
  source 'bar.erb'
  notifies :run, 'notify_group[Aggregate notifications using a single notify_group resource]', :immediately
end

notify_group 'Aggregate notifications using a single notify_group resource' do
  notifies :restart, 'service[foo]', :delayed
end

Configurable attributes

NameDefault valueConfigurable values
Version Added6.0.0String
Exclude
  • **/metadata.rb
  • **/Berksfile
Array

Was this page helpful?