Created
June 9, 2011 12:52
-
-
Save rubiojr/1016667 to your computer and use it in GitHub Desktop.
Fixes ruby 1.8.7 segfaulting in CentOS 5.6 i386
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -uNr chef-0.10.0.orig/lib/chef/provider/package/yum.rb chef-0.10.0/lib/chef/provider/package/yum.rb | |
--- chef-0.10.0.orig/lib/chef/provider/package/yum.rb 2011-06-09 13:46:42.000000000 +0100 | |
+++ chef-0.10.0/lib/chef/provider/package/yum.rb 2011-06-09 16:50:52.000000000 +0100 | |
@@ -29,6 +29,7 @@ | |
class YumCache | |
include Chef::Mixin::Command | |
include Singleton | |
+ include Chef::Mixin::ShellOut | |
def initialize | |
load_data | |
@@ -60,26 +61,22 @@ | |
error = String.new | |
helper = ::File.join(::File.dirname(__FILE__), 'yum-dump.py') | |
- status = popen4("python #{helper}", :waitlast => true) do |pid, stdin, stdout, stderr| | |
- stdout.each do |line| | |
- line.chomp! | |
- name, type, epoch, version, release, arch = line.split(',') | |
- type_sym = type.to_sym | |
- if !@data.has_key?(name) | |
- @data[name] = Hash.new | |
- end | |
- if !@data[name].has_key?(type_sym) | |
- @data[name][type_sym] = Hash.new | |
- end | |
- @data[name][type_sym][arch] = { :epoch => epoch, :version => version, | |
- :release => release } | |
+ shout = shell_out("/usr/bin/python #{helper}") | |
+ shout.stdout.each_line do |line| | |
+ line.chomp! | |
+ name, type, epoch, version, release, arch = line.split(',') | |
+ type_sym = type.to_sym | |
+ if !@data.has_key?(name) | |
+ @data[name] = Hash.new | |
end | |
- | |
- error = stderr.readlines | |
+ if !@data[name].has_key?(type_sym) | |
+ @data[name][type_sym] = Hash.new | |
+ end | |
+ @data[name][type_sym][arch] = { :epoch => epoch, :version => version, | |
+ :release => release } | |
end | |
- | |
- unless status.exitstatus == 0 | |
- raise Chef::Exceptions::Package, "yum failed - #{status.inspect} - returns: #{error}" | |
+ unless shout.exitstatus == 0 | |
+ raise Chef::Exceptions::Package, "yum failed - #{shout.stdout} - returns: #{shout.stderr}" | |
end | |
@updated_at = Time.now |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment