alternatives Resource
This page is generated from the Chef Infra Client source code.To suggest a change, edit the alternatives.rb file and submit a pull request to the Chef Infra Client repository.
Syntax
alternatives 'name' do
link String # default value: /usr/bin/LINK_NAME
link_name String # default value: The resource block's name
path String
priority String, Integer
action Symbol
end
Actions
:auto
- Set an alternative up in automatic mode with the highest priority automatically selected.
:install
- Install an alternative on the system including symlinks. (default)
:nothing
- This resource block does not act unless notified by another resource to take action. Once notified, this resource block either runs immediately or is queued up to run at the end of a Chef Infra Client run.
:refresh
- Refresh alternatives.
:remove
- Remove an alternative and all associated links.
:set
- Set the symlink for an alternative.
Properties
link
- Ruby Type: String
- Default Value:
/usr/bin/LINK_NAME
- The path to the alternatives link.
link_name
- Ruby Type: String
- Default Value:
The resource block's name
- The name of the link to create. This will be the command you type on the command line such as
ruby
orgcc
. path
- Ruby Type: String
- The absolute path to the original application binary such as
/usr/bin/ruby27
. priority
- Ruby Type: String, Integer
- The priority of the alternative.
Examples
Install an alternative:
alternatives 'python install 2' do
link_name 'python'
path '/usr/bin/python2.7'
priority 100
action :install
end
Set an alternative:
alternatives 'python set version 3' do
link_name 'python'
path '/usr/bin/python3'
action :set
end
Set the automatic alternative state:
alternatives 'python auto' do
link_name 'python'
action :auto
end
Refresh an alternative:
alternatives 'python refresh' do
link_name 'python'
action :refresh
end
Remove an alternative:
alternatives 'python remove' do
link_name 'python'
path '/usr/bin/python3'
action :remove
end
Was this page helpful?