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 defaultSupports autocorrectionTarget Chef Version
EnabledYesAll Versions

When notifying or subscribing an action 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

NameDefault valueConfigurable values
Version Added5.10.0String
Exclude
  • **/attributes/*.rb
  • **/metadata.rb
  • **/Berksfile
Array

Was this page helpful?









Search Results