Chef/Correctness/LazyInResourceGuard
The Cookstyle cops department: Chef/Correctness
Enabled by default | Supports autocorrection | Target Chef Version |
---|---|---|
Enabled | Yes | All Versions |
Using lazy {}
within a resource guard (not_if/only_if) will cause failures and is unnecessary as resource guards are always lazily evaluated.
Examples
incorrect
template '/etc/foo' do
mode '0644'
source 'foo.erb'
only_if { lazy { ::File.exist?('/etc/foo')} }
end
correct
template '/etc/foo' do
mode '0644'
source 'foo.erb'
only_if { ::File.exist?('/etc/foo') }
end
Configurable attributes
Name | Default value | Configurable values |
---|---|---|
Version Added | 6.18.0 | String |
Include | Array |