Puppet Version: 4.3.1
OS: Centos 7

Note: I am running MASTERLESS

I used this to install a gem :-

package { 'rubyzip':
    ensure   => present,
    provider => 'gem',
}

It installed fine, in this location : 
/usr/local/share/gems/gems/rubyzip-1.1.7

gem env shows that the parent folder is on the gem path :-

  - GEM PATHS:
     - /home/vagrant/.gem/ruby
     - /usr/share/gems
     - /usr/local/share/gems

However, when a Puppet manifest attempts to make use of that gem, it can't 
find it.

Puppet has its own location for gems, in this particular install its : 
/opt/puppetlabs/puppet/lib/ruby/gems/2.1.0/gems

If I change the package to include that directory as an install option, the 
gem is indeed installed there and Puppet can use it :-

  package { 'rubyzip':
    ensure   => present,
    provider => 'gem',
    install_options => {
            '--install-dir' => "/opt/puppetlabs/puppet/lib/ruby/gems/2.1.0"
      }
  }

However, this approach seems a bit of a hack and one that will utlimately 
create a maintenance overhead as/when Puppet's version of Ruby is updated, 
not to mention that we also run Puppet on other platforms (including 
Windows) which have different paths. I could handle that but it seems like 
there must be a better way of making this work cross platform without 
resorting to hard-coded paths even if that is parameterised.

Has anyone got a suggestion how to solve this one more elegantly.

Kind Regards

Fraser.

-- 
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/9073677f-6cca-40b4-8949-fba8553edee9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to