Skip to main content

DatabagHelpers

All Cookstyle Cops


The department is: Chef/Modernize

The full name of the cop is: Chef/Modernize/DatabagHelpers


Enabled by defaultSupports autocorrectionTarget Chef Version
EnabledYesAll Versions

Use the data_bag_item helper instead of Chef::DataBagItem.load or Chef::EncryptedDataBagItem.load.

Examples

incorrect

plain_text_data = Chef::DataBagItem.load('foo', 'bar')
encrypted_data = Chef::EncryptedDataBagItem.load('foo2', 'bar2')

correct

plain_text_data = data_bag_item('foo', 'bar')
encrypted_data = data_bag_item('foo2', 'bar2')

Configurable attributes

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

Was this page helpful?