Chef/Correctness/ConditionalUnifiedModeTrue
The Cookstyle cops department: Chef/Correctness
| Enabled by default | Supports autocorrection | Target Chef Version |
|---|---|---|
| Enabled | Yes | 15.3+ |
Setting unified_mode true conditionally leaves a resource running in unified mode on newer
Chef Infra Client releases and in legacy mode on older ones. That’s not a coherent thing to
want: the resource has to be written, tested, and debugged against both execution models.
Pick one. Set unified_mode true unconditionally and drop support for releases that predate
it, or set unified_mode false if respond_to?(:unified_mode) to deliberately opt out of
unified mode everywhere and keep writing the resource in the traditional style.
Only unified_mode true is flagged. unified_mode false under a guard is the supported way
to opt out and is left alone.
Examples
# bad
unified_mode true if respond_to?(:unified_mode)
# good
unified_mode true
# good - deliberately opting out of unified mode
unified_mode false if respond_to?(:unified_mode)
Configurable attributes
| Name | Default value | Configurable values |
|---|---|---|
| Version Added | 9.0.0 | String |
| Include |
| Array |