0

I'm trying to use a puppet provider which requires a ruby gem.

It's being run on Debian stable (wheezy), but I get the following error:

err: Could not run Puppet configuration client: no such file to load -- zabbixapi

The problem seems to be that puppet is requiring ruby1.8 specifically. However, the version of rubygems installed is for ruby1.9.1. Therefore all the gems which get installed end up in /var/lib/gems/1.9.1/gems/, which presumably version 1.8 of ruby doesn't look in.

What's the neatest way of having puppet code being able to require gems? I'm not really fussed which version of ruby ends up being used, provided it's consistent between rubygems and puppet.

lucas
  • 200
  • 3
  • 10
  • Time to bring your puppetmaster current. 2.7 is EOL. – Michael Hampton Dec 09 '14 at 01:07
  • The puppetmaster isn't the problem. It's on 3.7.2 (running on Debian unstable). However, puppet providers run on the clients and they're running Debian stable. As there's going to be lots of clients, I'd prefer to keep them all on a stable OS, rather than upgrading to a development version. – lucas Dec 09 '14 at 04:11

1 Answers1

0

A hacky solution to this is to hardcode the path of the required gem in ruby's load path.

file { '/etc/profile.d/rubylib.sh':
    content => 'export RUBYLIB=\'/var/lib/gems/1.9.1/gems/zabbixapi-2.4.0/lib\''
}

This is bad for a number of reasons:

  • Hardcodes version numbers
  • Need to run puppet multiple times
  • Need to log out and back in between puppet runs
  • Solves the problem in the wrong layer of abstraction

However, I've not found any better way of solving it, so this'll do for now.

lucas
  • 200
  • 3
  • 10