diff options
author | Tim Smith <tsmith84@gmail.com> | 2020-03-11 10:52:53 -0700 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2020-03-12 11:58:59 -0700 |
commit | 10e8ae47e255fb1ced9f594b0ce94f5f332a414c (patch) | |
tree | 1876e427810019e030b5bcfdc4ab1075717b5798 /kitchen-tests | |
parent | e5e0f8f399e2a52ace04702225d327a56db5438c (diff) | |
download | chef-10e8ae47e255fb1ced9f594b0ce94f5f332a414c.tar.gz |
Add alternatives resource for Linux
This comes from https://github.com/vkhatri/chef-alternatives
Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'kitchen-tests')
-rw-r--r-- | kitchen-tests/cookbooks/end_to_end/recipes/alternatives.rb | 51 | ||||
-rw-r--r-- | kitchen-tests/cookbooks/end_to_end/recipes/default.rb | 2 |
2 files changed, 52 insertions, 1 deletions
diff --git a/kitchen-tests/cookbooks/end_to_end/recipes/alternatives.rb b/kitchen-tests/cookbooks/end_to_end/recipes/alternatives.rb new file mode 100644 index 0000000000..8e0a0bb178 --- /dev/null +++ b/kitchen-tests/cookbooks/end_to_end/recipes/alternatives.rb @@ -0,0 +1,51 @@ +# +# Cookbook:: end_to_end +# Recipe:: alternatives +# + +file "/usr/local/sample-binary-1" do + content '#!/bin/bash + echo sample-binary-v1 + ' + mode "500" +end + +file "/usr/local/sample-binary-2" do + content '#!/bin/bash + echo sample-binary-v2 + ' + mode "550" +end + +alternatives "sample-binary v1" do + link_name "sample-binary" + path "/usr/local/sample-binary-1" + priority 100 + action :install +end + +alternatives "sample-binary v2" do + link_name "sample-binary" + path "/usr/local/sample-binary-2" + priority 101 + action :install +end + +alternatives "set sample-binary v1" do + link_name "sample-binary" + path "/usr/local/sample-binary-1" + action :set +end + +alternatives "sample-binary-test v1" do + link_name "sample-binary-test" + path "/usr/local/sample-binary-1" + priority 100 + action :install +end + +alternatives "sample-binary-test v1" do + link_name "sample-binary-test" + path "/usr/local/sample-binary-1" + action :remove +end diff --git a/kitchen-tests/cookbooks/end_to_end/recipes/default.rb b/kitchen-tests/cookbooks/end_to_end/recipes/default.rb index dc8b44cbf4..eeccb9ffd7 100644 --- a/kitchen-tests/cookbooks/end_to_end/recipes/default.rb +++ b/kitchen-tests/cookbooks/end_to_end/recipes/default.rb @@ -118,5 +118,5 @@ end end include_recipe "::chef-vault" unless includes_recipe?("end_to_end::chef-vault") - +include_recipe "::alternatives" include_recipe "::tests" |