diff options
author | Thom May <thom@may.lt> | 2015-11-12 10:08:53 +0000 |
---|---|---|
committer | Thom May <thom@may.lt> | 2015-11-12 10:08:53 +0000 |
commit | 8ca5eb3981a630aa11e8431ec8d7dd34236ebc36 (patch) | |
tree | a4755572ace1395e84c5dbbf98e5abfb461927e4 /lib | |
parent | f4a47f9e248d99fe6c284bcbff7c2b05d6dd0484 (diff) | |
parent | a65408a6d005ec5ca9270b0efd42fec74c7b7087 (diff) | |
download | chef-8ca5eb3981a630aa11e8431ec8d7dd34236ebc36.tar.gz |
Merge pull request #4142 from tas50/master
Use the proper python interpretor for yum-dump.py on Fedora 21+
Diffstat (limited to 'lib')
-rw-r--r-- | lib/chef/provider/package/yum.rb | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/chef/provider/package/yum.rb b/lib/chef/provider/package/yum.rb index aff8dc9326..6258472a65 100644 --- a/lib/chef/provider/package/yum.rb +++ b/lib/chef/provider/package/yum.rb @@ -785,7 +785,7 @@ class Chef def python_bin yum_executable = which(yum_binary) if yum_executable && shabang?(yum_executable) - extract_interpreter(yum_executable) + shabang_or_fallback(extract_interpreter(yum_executable)) else Chef::Log.warn("Yum executable not found or doesn't start with #!. Using default python.") "/usr/bin/python" @@ -797,7 +797,17 @@ class Chef end def extract_interpreter(file) - ::File.open(file, 'r', &:readline)[2..-1].chomp + ::File.open(file, 'r', &:readline)[2..-1].strip + end + + # dnf based systems have a yum shim that has /bin/bash as the interpreter. Don't use this. + def shabang_or_fallback(interpreter) + if interpreter == '/bin/bash' + Chef::Log.warn("Yum executable interpreter is /bin/bash. Falling back to default python.") + "/usr/bin/python" + else + interpreter + end end def shabang?(file) |