How can I install ruby193 gems on CentOS 6 with softwarecollections (SCL)?

374 views
Skip to first unread message

Stefan Lasiewski

unread,
Jul 7, 2015, 3:22:37 PM7/7/15
to puppet...@googlegroups.com
Hello,

I have a CentOS 6 system running Puppet 3.8, and I use SCL (Software Collections) to install some packages like http24 and ruby193.

I am having trouble using Puppet's gem provider to install gems with ruby193.

I have a manifest like this:


  package { ['ruby193', 'ruby193-ruby-devel', 'ruby193-rubygem-bundler']:                                        
   
ensure  => present,                                                                                          
   
require => Class['::company_yum::softwarecollections'],                                                        
 
}                                                                                                              
 
# Install Compass for webapp                                                                            
 
package { ['sass', 'compass']:                                                                                
   
ensure   => 'installed',                                                                                    
    provider
=> 'gem',                                                                                          
   
require  => Package['ruby193-ruby-devel'],                                                                  
 
}

 
But it seems that Puppet does not know about the location of the ruby193-ruby-devel headers, and I would need to use the SCL version of ruby193 gem, not /usr/bin/gem.


Notice: /Stage[main]/Class_webhost::Silverstripe/Package[ruby193-ruby-devel]/ensure: created

Error: Execution of '/usr/bin/gem install --no-rdoc --no-ri compass' returned 1: ERROR:  Error installing compass:


        ERROR: Failed to build gem native extension.


/usr/bin/ruby extconf.rb

mkmf.rb can't find header files for ruby at /usr/lib/ruby/ruby.h


Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/ffi-1.9.10 for inspection.

Results logged to /usr/lib/ruby/gems/1.8/gems/ffi-1.9.10/ext/ffi_c/gem_make.out

Building native extensions.  This could take a while...

Error: /Stage[main]/Class_webhost::Silverstripe/Package[compass]/ensure: change from absent to present failed: Execution of '/usr/bin/gem install --no-rdoc --no-ri compass' returned 1: ERROR:  Error installing compass:


        ERROR: Failed to build gem native extension.


/usr/bin/ruby extconf.rb

mkmf.rb can't find header files for ruby at /usr/lib/ruby/ruby.h



Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/ffi-1.9.10 for inspection.

Results logged to /usr/lib/ruby/gems/1.8/gems/ffi-1.9.10/ext/ffi_c/gem_make.out

Building native extensions.  This could take a while...

...

Notice: Finished catalog run in 50.02 seconds



The ruby193-ruby-devel headers live under /opt/rh/ruby193/ :

[root@webhost ~]# find /opt/rh/ruby193/root/ -name ruby.h
/opt/rh/ruby193/root/usr/include/ruby/ruby.h
/opt/rh/ruby193/root/usr/include/ruby.h
[root@webhost ~]#



How can I use the Puppet gem provider to work with ruby193 installed by SCL?

Thanks,

-= Stefan

Stefan Lasiewski

unread,
Jul 14, 2015, 2:56:14 PM7/14/15
to puppet...@googlegroups.com
From the silence, I'm going to guess that the gem provider cannot install gems from Ruby installed from the Software Collections.

I did find a somewhat-related bug: '[PUP-3613] Add a parameter to the exec resource to support running commands in software collections without always using "scl enable"'

-= Stefan

Ilja Bobkevic

unread,
Jul 22, 2015, 11:34:03 AM7/22/15
to Puppet Users
I guess you're left with doing exec. Something like this should work:

    exec { 'ruby193_scl_install_blah':
      command => "scl enable ruby193 'gem install --bindir /usr/bin --no-rdoc --no-ri blah'",
      path    
=> ['/bin','/usr/bin'],
     
unless  => "scl enable ruby193 'gem list'| grep -qs blah"
   
}

There might be already defined type for it out there (e.g. https://forge.puppetlabs.com/treydock/scl)

// Ilja
Reply all
Reply to author
Forward
0 new messages