blt04 / puppet-rvm

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

Ordering problem when installing passenger #57

Open rsyring opened 11 years ago

rsyring commented 11 years ago

Thanks for your efforts with this module, its been very helpful so far. I have ran into an issue I wanted to report. When using the following in a node:

include rvm
rvm_system_ruby {
    'ruby-1.9.3-p327':
        ensure => 'present',
        default_use => true;
    'ruby-1.8.7-p370':
        ensure => 'present',
        default_use => false;
}
class {
    'rvm::passenger::apache':
        version => '3.0.18',
        ruby_version => 'ruby-1.8.7-p370',
        mininstances => '3',
        maxpoolsize => '30',
}

The first run on the node results in errors:

Error: Could not update: Execution of '/usr/local/rvm/bin/rvm ruby-1.8.7-p370 do gem install -v 3.0.18 --include-dependencies --no-rdoc --no-ri passenger' returned 1: Ruby ruby-1.8.7-p370 is not installed.

Error: /Stage[main]/Rvm::Passenger::Gem/Rvm_gem[passenger]/ensure: change from absent to 3.0.18 failed: Could not update: Execution of '/usr/local/rvm/bin/rvm ruby-1.8.7-p370 do gem install -v 3.0.18 --include-dependencies --no-rdoc --no-ri passenger' returned 1: Ruby ruby-1.8.7-p370 is not installed.

/Stage[main]/Rvm::Passenger::Apache::Ubuntu::Post/Exec[passenger-install-apache2-module]: Dependency Rvm_gem[passenger] has failures: true
Warning: /Stage[main]/Rvm::Passenger::Apache::Ubuntu::Post/Exec[passenger-install-apache2-module]: Skipping because of failed dependencies
/Stage[main]/Rvm::Passenger::Apache::Ubuntu::Post/File[/etc/apache2/mods-available/passenger.conf]: Dependency Rvm_gem[passenger] has failures: true
Warning: /Stage[main]/Rvm::Passenger::Apache::Ubuntu::Post/File[/etc/apache2/mods-available/passenger.conf]: Skipping because of failed dependencies
/Stage[main]/Rvm::Passenger::Apache::Ubuntu::Post/File[/etc/apache2/mods-enabled/passenger.conf]: Dependency Rvm_gem[passenger] has failures: true
Warning: /Stage[main]/Rvm::Passenger::Apache::Ubuntu::Post/File[/etc/apache2/mods-enabled/passenger.conf]: Skipping because of failed dependencies
/Stage[main]/Rvm::Passenger::Apache::Ubuntu::Post/File[/etc/apache2/mods-available/passenger.load]: Dependency Rvm_gem[passenger] has failures: true
Warning: /Stage[main]/Rvm::Passenger::Apache::Ubuntu::Post/File[/etc/apache2/mods-available/passenger.load]: Skipping because of failed dependencies
/Stage[main]/Rvm::Passenger::Apache::Ubuntu::Post/File[/etc/apache2/mods-enabled/passenger.load]: Dependency Rvm_gem[passenger] has failures: true
Warning: /Stage[main]/Rvm::Passenger::Apache::Ubuntu::Post/File[/etc/apache2/mods-enabled/passenger.load]: Skipping because of failed dependencies

I tried adding a Require:

class {
    'rvm::passenger::apache':
        version => '3.0.18',
        ruby_version => 'ruby-1.8.7-p370',
        mininstances => '3',
        maxpoolsize => '30',
        require => Rvm_system_ruby['ruby-1.8.7-p370'];
}

But that didn't seem to help.

The second time I run the agent on the node, passenger installs just fine.

I resolved this by modifying rvm::passenger::gem:

class rvm::passenger::gem($ruby_version, $version) {
  rvm_gem {
    "passenger":
      ensure       => $version,
      ruby_version => $ruby_version,
      require      => Rvm_system_ruby[$ruby_version]; # <-- added this line
  }
}

To require the system ruby. I then did a rm -rf /usr/local/rvm and ran the agent again, this time without error.

TJM commented 11 years ago

This looks like it might be a good resolution to my problem too...

http://stackoverflow.com/questions/14908384/puppet-ordering-passenger-install-before-ruby-install

I tried several different ways to get the ruby install to run before the passenger install, but hadn't yet tried modifying the RVM module itself.

This is already fixed in a pull request: https://github.com/blt04/puppet-rvm/pull/60

Thanks!

Tommy