I was constantly running into issues when using this Puppet module (using
puppet apply) inside a Ruby project folder containing
.ruby-version file. RVM parses this file while checking what version of Ruby it should use and sadly, it also does that while running
/usr/local/rvm/bin/rvm. The problem is that, if Ruby version defined in
.ruby-version is not installed, current version of RVM Puppet module will not detect that, because calling
/usr/local/rvm/bin/rvm from inside a Ruby project folder would give something like this:
ernestas@vbox-ubuntu:~/ss$ /bin/sh -c '/usr/local/rvm/bin/rvm list strings'
ruby-2.3.0 is not installed.
To install do: 'rvm install ruby-2.3.0'
Not only that, it can produce other warnings like:
$ rvm list strings
Warning! PATH is not properly set up, '/usr/local/rvm/gems/ruby-2.3.1/bin' is not at first place,
usually this is caused by shell initialization files - check them for 'PATH=...' entries,
it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles',
to fix temporarily in this shell session run: 'rvm use ruby-2.3.1'.
Sadly, not all of the warnings go to stderr, thus, it's not an option to just ignore stderr. We need to check for Ruby versions only from the beginning of a line.
ensure => latest,
gemlist is called to determine the latest
available version of a gem.
source parameter is a remote gem repository, this needs to be
part of the
gem list command run.
gem 3.0 dropped support for
We must use
At the moment if the package curl is already defined somewhere else, the dependency between system-rvm and curl isn't set properly.
Also there is no point in checking whether the package curl defined before doing an ensure packages.
Instead, just before doing the curl, we do an ensure packages (this way we only do it when necessary), and now the system-rvm exec requires the curl package.
Hi, I added the possibility to load gems from a puppet filemount. Please review.
Have your gem in /modules/mygeminstaller/files/mygem-1.0.0.gem
name => 'mygem',
ruby_version => 'ruby-2.0.0',
ensure => '1.0.0',
require => Rvm_system_ruby['ruby-2.0.0'],
source => 'puppet:///modules/mygeminstaller/mygem-1.0.0.gem',
This fix will ensure Puppet can generate all types for this module to ensure environment isolation can be set up.
If I understand correctly, the module currently relies on a script it downloads to call for verification.
I propose to download the installer and the detached key, verify and install as described here: https://rvm.io/rvm/security instead.
It is a bit procedural and maybe not the best style but it beats piping unverified code to bash IMO.