summaryrefslogtreecommitdiff
path: root/spec/unit/provider/package
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2015-11-05 10:00:05 -0800
committerTim Smith <tsmith84@gmail.com>2015-11-05 10:00:05 -0800
commita65408a6d005ec5ca9270b0efd42fec74c7b7087 (patch)
tree1a869612a94fff06c897ec60955f7527fd6165bc /spec/unit/provider/package
parent5020cc6df7cffe45eddddbedcc2a1e18c55cf1e5 (diff)
downloadchef-a65408a6d005ec5ca9270b0efd42fec74c7b7087.tar.gz
Use the proper python interpretor for yum-dump.py on Fedora 21+
Fedora 21+ use dnf as the primary package manager. Lamont added code in 12.5 to allow for a yum compat mode. This doesn't entirely work though as we need yum-dump.py to correctly run. We were parsing the shabang in the yum binary to find the path to python. On a dnf system the yum binary is a bash script though so we were trying to run yum-dump.py using bash which obviously fails. I added a fallback method to use python if the shebang parsing returns bash. With this in place AND the yum package installed you can use the package resource on Fedora.
Diffstat (limited to 'spec/unit/provider/package')
-rw-r--r--spec/unit/provider/package/yum_spec.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/spec/unit/provider/package/yum_spec.rb b/spec/unit/provider/package/yum_spec.rb
index 3fc0b807c9..b37a675bf2 100644
--- a/spec/unit/provider/package/yum_spec.rb
+++ b/spec/unit/provider/package/yum_spec.rb
@@ -1844,6 +1844,12 @@ EOF
expect(@yc.python_bin).to eq("/usr/bin/python")
end
+ it "should return /usr/bin/python if the interpreter is /bin/bash" do
+ other = StringIO.new("#!/bin/bash\n# The yum executable redirecting to dnf from dnf-yum compatible package.")
+ allow(::File).to receive(:open).with("/usr/bin/yum", "r") { |&b| r = b.call(other); other.rewind; r}
+ expect(@yc.python_bin).to eq("/usr/bin/python")
+ end
+
it "should return the interpreter for yum" do
other = StringIO.new("#!/usr/bin/super_python\n\nlasjdfdsaljf\nlasdjfs")
allow(::File).to receive(:open).with("/usr/bin/yum", "r") { |&b| r = b.call(other); other.rewind; r}