Skip to main content

NotifiesActionNotSymbol

All Cookstyle Cops


The department is: Chef/Correctness

The full name of the cop is: Chef/Correctness/NotifiesActionNotSymbol


Enabled by default Supports autocorrection Target Chef Version
Enabled Yes All Versions

When notifying or subscribing actions within a resource the action should always be a symbol. In Chef Infra Client releases before 14.0, this may result in double notification.

Examples

incorrect

execute 'some command' do
  notifies 'restart', 'service[httpd]', 'delayed'
end

execute 'some command' do
  subscribes 'restart', 'service[httpd]', 'delayed'
end

correct

execute 'some command' do
  notifies :restart, 'service[httpd]', 'delayed'
end

execute 'some command' do
  subscribes :restart, 'service[httpd]', 'delayed'
end

Configurable attributes

Name Default value Configurable values
Version Added 5.10.0 String
Exclude
  • **/attributes/*.rb
  • **/metadata.rb
  • **/Berksfile
Array

Was this page helpful?

×









Search Results