Ok, the "easy" way is to implement one's own package-provider. Fortunately, one can inherit everything from the existing gem-provider overriding only the gem-command itself.
Because SCL's rh-ruby22 is so retarded, you can't even invoke its ruby
or gem
directly -- without setting LD_LIBRARY_PATH
first -- we create wrappers for them in /usr/bin
. The /usr/bin/gem2
, for example, sets the library path (and PATH
) and then exec
s the real /opt/rh/rh-ruby22/root/usr/bin/gem
with its own arguments ("$@"
).
My new provider uses the gem2
wrapper script to do its thing.
I created the file gem2.rb
in modules/SOMEMODULE/lib/puppet/provider/package/
with the following content (tested with Puppet-3.8.7):
require 'puppet/provider/package'
Puppet::Type.type(:package).provide File.basename(__FILE__, ".rb"),
:parent => :gem, :source => :gem do
desc "Ruby Gem support using #{@name}-executable"
commands :gemcmd => @name.to_s
end
Though I was hoping, my implementation would allow one to specify the gem-command as a parameter in the puppet-manifest, it is impossible to do this without completely rewriting the existing gem-provider. My way is much easier and just as efficient.
As a bonus, copying the file to some other name (such as gem19.rb
) will automatically create the new provider -- just be sure, gem19
is in the $PATH
.
The module, under which you'll save this file, can be any module used by the machine(s) that need the new provider.