Skip to main content

ConditionalUsingTest

The department is: ConditionalUsingTest

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

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

Use ::File.exist?('/foo/bar') instead of the slower ‘test -f /foo/bar’ which requires shelling out

Examples

incorrect

only_if 'test -f /bin/foo'

correct

only_if { ::File.exist?('bin/foo') }

Configurable attributes

Name Default value Configurable values
Version Added 6.11.0 String
Include
Array

Was this page helpful?

×









Search Results