class RuboCop::Cop::Chef::Deprecations::LogResourceNotifications
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.
@example
#### 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
Constants
- MSG
Public Instance Methods
on_block(node)
click to toggle source
# File lib/rubocop/cop/chef/deprecation/log_resource_notifications.rb, line 54 def on_block(node) match_property_in_resource?(:log, 'notifies', node) do |prop_node| add_offense(prop_node, message: MSG, severity: :warning) end end