Issue #15145 has been updated by Matthaus Litteken.

TMZ suggested the following patch (<http://pastie.org/4128032>), which produces 
the expected output on ruby 1.8.5, 1.8.7, 1.9.3. The reason this is breaking on 
1.9 is that the fact looks for site_ruby/1.9 when ruby 1.9.2 and 1.9.3 use 
site_ruby/1.9.1.

    From 8235d2246de440dc55d3349fe7e459690feed70b Mon Sep 17 00:00:00 2001
    From: Todd Zullinger <[email protected]>
    Date: Thu, 21 Jun 2012 15:10:11 -0400
    Subject: [PATCH/facter] Improve rubysitedir fact
    With ruby-1.9.3 -- at least on Fedora 17 -- trawling through the library
    paths looking for the directory does not work.  Using RbConfig seems
    more reliable and much simpler.
    ---
    lib/facter/rubysitedir.rb |   12 +++---------
    1 files changed, 3 insertions(+), 9 deletions(-)
    diff --git a/lib/facter/rubysitedir.rb b/lib/facter/rubysitedir.rb
    index 73aa215..930df38 100644
    --- a/lib/facter/rubysitedir.rb
    +++ b/lib/facter/rubysitedir.rb
    @@ -2,17 +2,11 @@
    #
    # Purpose: Returns Ruby's site library directory.
    #
    -# Resolution: Works out the version to major/minor (1.8, 1.9, etc), then 
joins
    -# that with all the $: library paths.
    -#
    -# Caveats:
    -#
    +
    +require 'rbconfig'
    Facter.add :rubysitedir do
    setcode do
    -    version = RUBY_VERSION.to_s.sub(/\.\d+$/, '')
    -    $:.find do |dir|
    -      dir =~ /#{File.join("site_ruby", version)}$/
    -    end
    +    RbConfig::CONFIG["sitelibdir"]
    end
    end
    -- 
    1.7.6
----------------------------------------
Bug #15145: rubysitedir fact / Ruby path not detected with Ruby 1.9.3
https://projects.puppetlabs.com/issues/15145#change-65557

Author: Chilly Cold
Status: Unreviewed
Priority: Normal
Assignee: 
Category: 
Target version: 
Keywords: 
Branch: 
Affected Facter version: 


I've found that the rubysitedir fact is not available anymore in Fedora 17 and 
probably other nix systems running ruby 1.9.3.

Looking at the rubysitedir.rb I see : 

Facter.add :rubysitedir do
  setcode do
    version = RUBY_VERSION.to_s.sub(/\.\d+$/, '')
    $:.find do |dir|
      dir =~ /#{File.join("site_ruby", version)}$/
    end
  end
end

Meaning it's looking for a path containing "site_ruby" which doesn't exist 
anymore with ruby 1.9.3. It seems to be now located in /usr/share/ruby/...

Has someone a workaround or a patch for that ?

Thanks




-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to