blt04 / puppet-rvm

A puppet module for installing and using RVM (Ruby Version Manager)
Other
242 stars 280 forks source link

Workaround Puppets late binding issue for resources by Being Clever(TM) #39

Closed rwilcox closed 12 years ago

rwilcox commented 12 years ago

This pull request works around the late binding issue for Providers by faking out Puppet.

With these modifications I was able to take a virgin virtual machine that has never seen RVM and install RVM, a Ruby, and a gemset for that Ruby.

It works by faking out Puppet - saying that it will run a command (the true command), but then turns around and runs RVM at runtime. Sneaky, and probably something that would get me kicked out of the Puppet Users Guild Of Best Practicing Artisans... but it works! :)

Let me know if you have any questions or if there's anything I can do to make this patch better! _Ryan Wilcox

blt04 commented 12 years ago

Thanks for the pull request. I can see how this would work, but it could also have some unintended consequences. For example, what if /usr/local/rvm/bin/rvm doesn't exist (either because it the rvm installer failed or the user forgot to include the rvm module correctly)?

Run stages work for me. I can install RVM, a Ruby, a gemset and some gems on a virgin virtual machine with one puppet run.

rwilcox commented 12 years ago

While I agree that run stages should work, they don't for me. Take a look at my puppet manifest (https://github.com/rwilcox/vagrant_base/blob/master/manifests/lucid32.pp), and do my RVM stuff in a require => Stage["Main"] stage, and no dice.

RVM-Puppet for me errors out in some calculation phase, before it has installed any packages. (Running Puppet 2.7.11).

It's possible my manifest file is doing something wrong, which is why I got an error (in which case let me know and I'll fix up the documentation or add an example or something), but I'm not sure.

blt04 commented 12 years ago

I don't see anything obvious. Maybe you could post the exact error message?

rwilcox commented 12 years ago

The error message: Could not find a default provider for rvm_gemset. If you want I can post a sample Vagrant project which shows this behavior.

blt04 commented 12 years ago

I think that would be helpful (the sample vagrant project). I'm unable to reproduce the error you are seeing as is.

I'm going to close this pull request for now as I don't think it's the right approach. Run stages work for me. If you do post the vagrant setup that generates the bug, open a new issue and I'll take a look.

And thank you for the pull request, even if I didn't end up using it!

rwilcox commented 12 years ago

Post Issue #41, which includes a sample Vagrantfile + manifests. Let me know if you have any questions or comments, or figure out what I did wrong...