[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: require-rubygems test and ohai



On Sun, Jan 29, 2012 at 1:11 PM, Praveen A <pravi.a@gmail.com> wrote:
> lib/ohai/plugins/ruby.rb has the following check to find rubygems.
> Does it need to be commented out?
>
> # Perform one more (conditional) query
> bin_dir = languages[:ruby][:bin_dir]
> ruby_bin = languages[:ruby][:ruby_bin]
> gem_binaries = [
>  run_ruby("require 'rubygems'; puts ::Gem.default_exec_format % 'gem'"),
>  "gem"
> ].map {|bin| ::File.join(bin_dir, bin)}
> gem_binary = gem_binaries.find {|bin| ::File.exists? bin }
> if gem_binary
>  languages[:ruby][:gems_dir] = run_ruby "puts %x{#{ruby_bin}
> #{gem_binary} env gemdir}.chomp!"
>  languages[:ruby][:gem_bin] = gem_binary
> end

No.  Removing it breaks the profiling and the plugin and would render
it useless and tainted in that what a user would get if they did gem
install ohai and what they would get if they installed it using apt
would be two different things by default, the latter never returning
information about Ruby and it's Gem binary location and paths and the
former returning the proper system information.  It's not profiling to
use it (I assume because it's a plugin and I don't see where it
attempts to use that binary) it just returns it as part of the
profile.


Reply to: