public
Last active

Fixes ruby 1.8.7 segfaulting in CentOS 5.6 i386

  • Download Gist
yum-provider-patch.diff
Diff
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
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

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.