voxpupuli / puppet-rvm

A puppet module for installing and using RVM (Ruby Version Manager)
https://forge.puppet.com/puppet/rvm
BSD 3-Clause "New" or "Revised" License
32 stars 102 forks source link

Error while resolving custom fact fact='rvm_version' #189

Closed jplindquist closed 1 year ago

jplindquist commented 1 year ago

Affected Puppet, Ruby, OS and module versions/distributions

How to reproduce (e.g Puppet code you use)

/usr/local/rvm/bin/rvm get master

/usr/local/rvm/bin/rvm version
rvm 1.29.12-next (master) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]

Run puppet with nodejs class enabled

What are you seeing

/usr/local/rvm/bin/rvm version
rvm 1.29.12-next (master) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]

The fact for rvm_version fails to resolve (output below)

What behaviour did you expect instead

The fact properly resolves the RVM version

Output log

Error: Facter: Error while resolving custom fact fact='rvm_version', resolution='<anonymous>': undefined method `[]' for nil:NilClass
Debug: Facter: value for rvm_version is still nil

Any additional information you'd like to impart

This appears to be because of the space in the regex, and not expecting or matching on the -next in the version upon getting master here

I don't know if it's just easy enough to change that from rvm ([0-9]+\.[0-9]+\.[0-9]+) .* to rvm ([0-9]+\.[0-9]+\.[0-9]+).* (removing the space after the capture group), or if there's a more preferred way to do that. I did some quick testing and removing the space at least seemed to match the version as expected resolving it was 1.29.12 at least (not sure if -next should be captured or not though...)

Happy to help contribute an update either way. Thanks!