Chef/Modernize/ExecuteUpdateAlternatives
The Cookstyle cops department: Chef/Modernize
| Enabled by default | Supports autocorrection | Target Chef Version |
|---|---|---|
| Enabled | No | 16.0+ |
Chef Infra Client 16.0 and later includes an alternatives resource that should be used to
manage alternatives links instead of shelling out to update-alternatives or alternatives.
The resource is idempotent and handles both the Debian and RHEL flavours of the command, where
an execute re-runs on every converge and reports the resource as updated every time.
Examples
# bad
execute 'install java alternative' do
command 'update-alternatives --install /usr/bin/java java /usr/lib/jvm/jre-11/bin/java 1'
end
execute 'alternatives --set java /usr/lib/jvm/jre-11/bin/java'
# good
alternatives 'java' do
link '/usr/bin/java'
path '/usr/lib/jvm/jre-11/bin/java'
priority 1
action :install
end
Configurable attributes
| Name | Default value | Configurable values |
|---|---|---|
| Version Added | 9.0.0 | String |
| Include | Array |