Skip to content

Commit

Permalink
Don't use Facter rvm_binary in providers
Browse files Browse the repository at this point in the history
Facter facts are not re-evaluated for each install stage.  This commit
uses a different mechanism to locate the rvm binary.

Refs #34.
  • Loading branch information
blt04 committed Feb 16, 2012
1 parent 0b893e4 commit d6e9527
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 5 deletions.
13 changes: 13 additions & 0 deletions lib/puppet/provider/rvm.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module Puppet
module Rvm
def self.rvm_binary
paths = [
'/usr/local/rvm/bin/rvm',
'/usr/local/bin/rvm',
'/usr/rvm/bin/rvm',
'/usr/bin/rvm'
]
paths.find {|p| File.exist?(p)} || paths[0]
end
end
end
3 changes: 2 additions & 1 deletion lib/puppet/provider/rvm_gem/gem.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
require 'puppet/provider/package'
require 'uri'
require 'puppet/provider/rvm'

# Ruby gems support.
Puppet::Type.type(:rvm_gem).provide(:gem) do
desc "Ruby Gem support using RVM."

commands :rvmcmd => Facter.value(:rvm_binary)
commands :rvmcmd => Puppet::Rvm.rvm_binary


def ruby_version
Expand Down
4 changes: 3 additions & 1 deletion lib/puppet/provider/rvm_gemset/gemset.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
require 'puppet/provider/rvm'

# RVM gemset support
Puppet::Type.type(:rvm_gemset).provide(:gemset) do
desc "RVM gemset support."

commands :rvmcmd => Facter.value(:rvm_binary)
commands :rvmcmd => Puppet::Rvm.rvm_binary

def ruby_version
resource[:ruby_version]
Expand Down
4 changes: 3 additions & 1 deletion lib/puppet/provider/rvm_system_ruby/rvm_system_ruby.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
require 'puppet/provider/rvm'

Puppet::Type.type(:rvm_system_ruby).provide(:rvm) do
desc "Ruby RVM support."

commands :rvmcmd => Facter.value(:rvm_binary)
commands :rvmcmd => Puppet::Rvm.rvm_binary

def create
rvmcmd "install", resource[:name]
Expand Down
2 changes: 1 addition & 1 deletion manifests/passenger/apache/centos/post.pp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
) {

exec { 'passenger-install-apache2-module':
command => "$rvm_binary $ruby_version exec passenger-install-apache2-module -a",
command => "$rvmpath/bin/rvm $ruby_version exec passenger-install-apache2-module -a",
creates => "${gempath}/passenger-${version}/ext/apache2/mod_passenger.so",
logoutput => 'on_failure',
require => [Rvm_gem['passenger'], Package['httpd','httpd-devel','mod_ssl']];
Expand Down
2 changes: 1 addition & 1 deletion manifests/passenger/apache/ubuntu/post.pp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

exec {
'passenger-install-apache2-module':
command => "$rvm_binary ${ruby_version} exec passenger-install-apache2-module -a",
command => "$rvmpath/bin/rvm ${ruby_version} exec passenger-install-apache2-module -a",
creates => "${gempath}/passenger-${version}/ext/apache2/mod_passenger.so",
logoutput => 'on_failure',
require => [Rvm_gem['passenger'], Package['apache2', 'build-essential', 'apache2-prefork-dev',
Expand Down

0 comments on commit d6e9527

Please sign in to comment.