summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2020-03-12 15:30:22 -0700
committerTim Smith <tsmith84@gmail.com>2020-03-12 15:30:22 -0700
commit229dd7b732a9635b1dace2b543706f1380e7ed35 (patch)
tree48134e8ce47758a271695b181063983eeb661895
parent349eb40626388b98b1da96f330d364809b3ba637 (diff)
downloadchef-229dd7b732a9635b1dace2b543706f1380e7ed35.tar.gz
Flip the alternatives_cmd logic to support SLES
Everything but debian is alternatives so make that the else. Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--lib/chef/resource/alternatives.rb6
-rw-r--r--spec/unit/resource/alternatives_spec.rb5
2 files changed, 8 insertions, 3 deletions
diff --git a/lib/chef/resource/alternatives.rb b/lib/chef/resource/alternatives.rb
index e5e9461c71..ab99365399 100644
--- a/lib/chef/resource/alternatives.rb
+++ b/lib/chef/resource/alternatives.rb
@@ -102,10 +102,10 @@ class Chef
# @return [String] The appropriate alternatives command based on the platform
#
def alternatives_cmd
- if fedora_derived?
- "alternatives"
- else
+ if debian?
"update-alternatives"
+ else
+ "alternatives"
end
end
diff --git a/spec/unit/resource/alternatives_spec.rb b/spec/unit/resource/alternatives_spec.rb
index 0d1755ef52..16c644e398 100644
--- a/spec/unit/resource/alternatives_spec.rb
+++ b/spec/unit/resource/alternatives_spec.rb
@@ -60,6 +60,11 @@ describe Chef::Resource::Alternatives do
expect(provider.alternatives_cmd).to eql("alternatives")
end
+ it "returns alternatives on suse" do
+ node.automatic_attrs[:platform_family] = "suse"
+ expect(provider.alternatives_cmd).to eql("alternatives")
+ end
+
it "returns alternatives on redhat" do
node.automatic_attrs[:platform_family] = "rhel"
expect(provider.alternatives_cmd).to eql("alternatives")