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

Den tisdag 14 juli 2015 kl. 20:56:14 UTC+2 skrev Stefan Lasiewski:
>
> 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"' 
> <https://tickets.puppetlabs.com/browse/PUP-3613>
>
> -= Stefan
>
> On Tuesday, July 7, 2015 at 12:22:37 PM UTC-7, Stefan Lasiewski wrote:
>>
>> Hello,
>>
>> I have a CentOS 6 system running Puppet 3.8, and I use SCL (Software 
>> Collections <https://www.softwarecollections.org>) 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
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/f367cfaf-a38b-4ea2-8775-954ca23b65fc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to