Skip to main content

NodeMethodsInsteadofAttributes

All Cookstyle Cops


The department is: Chef/Deprecations

The full name of the cop is: Chef/Deprecations/NodeMethodsInsteadofAttributes


Enabled by defaultSupports autocorrectionTarget Chef Version
EnabledYesAll Versions

Use node attributes to access data provided by Ohai instead of using node methods to access that data.

Examples

incorrect

node.fqdn
node.platform
node.platform_family
node.platform_version
node.hostname

correct

node['fqdn']
node['platform']
node['platform_family']
node['platform_version']
node['hostname']

Configurable attributes

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

Was this page helpful?