class RuboCop::Cop::Chef::Correctness::InvalidNotificationResource

The resource to notify when calling ‘notifies` or `subscribes` must be a string.

@example

#### incorrect

template '/etc/www/configures-apache.conf' do
  notifies :restart, service['apache'], :immediately
end

template '/etc/www/configures-apache.conf' do
  notifies :restart, service[apache], :immediately
end

#### correct

template '/etc/www/configures-apache.conf' do
  notifies :restart, 'service[apache]', :immediately
end

Constants

MSG
RESTRICT_ON_SEND

Public Instance Methods

on_send(node) click to toggle source
# File lib/rubocop/cop/chef/correctness/invalid_notification_resource.rb, line 50
def on_send(node)
  invalid_notification?(node) do |resource|
    add_offense(resource, severity: :refactor)
  end
end