From 73f94870ebbf39f62073675c7228faf4cbee19b8 Mon Sep 17 00:00:00 2001 From: jonoterc Date: Mon, 7 Apr 2014 13:41:47 -0400 Subject: [PATCH] revert apache::mod::passenger default parameters for RedHat The prior commit modified the default parameters for mod::passenger for RedHat, hardcoding paths related to the installed package; these changes were unnecessary and are being reverted. The changes were originally prompted by (new) spec acceptance temps leveraging passenger-status (to verify that passenger is running); these tests were not working under RedHat; revisiting with the original default parameters revealed that the RedHat tests were misconfigured (the required PASSENGER_TMPDIR environment was not being set), so those have been corrected. Also, spec/class tests have be reverted to reflect the (reverted) expected parameters. --- manifests/params.pp | 8 +++--- spec/acceptance/mod_passenger_spec.rb | 41 ++++++++++++++++++--------- spec/classes/mod/passenger_spec.rb | 9 ++++-- 3 files changed, 38 insertions(+), 20 deletions(-) diff --git a/manifests/params.pp b/manifests/params.pp index eaedc148e..43f3566af 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -49,10 +49,10 @@ $default_ssl_cert = '/etc/pki/tls/certs/localhost.crt' $default_ssl_key = '/etc/pki/tls/private/localhost.key' $ssl_certs_dir = '/etc/pki/tls/certs' - $passenger_conf_file = 'passenger.conf' - $passenger_conf_package_file = undef - $passenger_root = '/usr/lib/ruby/gems/1.8/gems/passenger-3.0.19' - $passenger_ruby = '/usr/bin/ruby' + $passenger_conf_file = 'passenger_extra.conf' + $passenger_conf_package_file = 'passenger.conf' + $passenger_root = undef + $passenger_ruby = undef $suphp_addhandler = 'php5-script' $suphp_engine = 'off' $suphp_configpath = undef diff --git a/spec/acceptance/mod_passenger_spec.rb b/spec/acceptance/mod_passenger_spec.rb index 7443b0e8b..e1ea23ec8 100644 --- a/spec/acceptance/mod_passenger_spec.rb +++ b/spec/acceptance/mod_passenger_spec.rb @@ -17,8 +17,10 @@ mod_dir = '/etc/httpd/conf.d/' conf_file = "#{mod_dir}passenger.conf" load_file = "#{mod_dir}passenger.load" - passenger_root = '/usr/lib/ruby/gems/1.8/gems/passenger-3.0.19' + # sometimes installs as 3.0.12, sometimes as 3.0.19 - so just check for the stable part + passenger_root = '/usr/lib/ruby/gems/1.8/gems/passenger-3.0.1' passenger_ruby = '/usr/bin/ruby' + passenger_tempdir = '/var/run/rubygem-passenger' passenger_module_path = 'modules/mod_passenger.so' rackapp_user = 'apache' rackapp_group = 'apache' @@ -67,7 +69,7 @@ class { 'apache::mod::passenger': } it { should be_enabled } it { should be_running } end - + describe file(conf_file) do it { should contain "PassengerRoot \"#{passenger_root}\"" } it { should contain "PassengerRuby \"#{passenger_ruby}\"" } @@ -84,11 +86,11 @@ class { 'apache::mod::passenger': } r.stdout.should =~ /Passenger processes/ r.stdout.should =~ /### Processes: [0-9]+/ r.stdout.should =~ /### Total private dirty RSS: [0-9\.]+ MB/ - + r.exit_code.should == 0 end end - + # passenger-status fails under stock ubuntu-server-12042-x64 + mod_passenger, # even when the passenger process is successfully installed and running unless fact('operatingsystem') == 'Ubuntu' && fact('operatingsystemrelease') == '12.04' @@ -102,19 +104,19 @@ class { 'apache::mod::passenger': } r.stdout.should =~ /active[ ]+= [0-9]+/ r.stdout.should =~ /inactive[ ]+= [0-9]+/ r.stdout.should =~ /Waiting on global queue: [0-9]+/ - + r.exit_code.should == 0 end end end - + it 'should answer to passenger.example.com' do shell("/usr/bin/curl passenger.example.com:80") do |r| r.stdout.should =~ /^hello world<\/b>$/ r.exit_code.should == 0 end end - + end when 'RedHat' @@ -173,20 +175,31 @@ class { 'apache::mod::passenger': it { should be_enabled } it { should be_running } end - + describe file(conf_file) do - it { should contain "PassengerRoot \"#{passenger_root}\"" } - it { should contain "PassengerRuby \"#{passenger_ruby}\"" } + it { should contain "PassengerRoot #{passenger_root}" } + it { should contain "PassengerRuby #{passenger_ruby}" } + it { should contain "PassengerTempDir #{passenger_tempdir}" } end describe file(load_file) do it { should contain "LoadModule passenger_module #{passenger_module_path}" } end - # note: passenger-memory-stats is not installed on Redhat + it 'should output status via passenger-memory-stats' do + shell("sudo /usr/bin/passenger-memory-stats") do |r| + r.stdout.should =~ /Apache processes/ + r.stdout.should =~ /Nginx processes/ + r.stdout.should =~ /Passenger processes/ + r.stdout.should =~ /### Processes: [0-9]+/ + r.stdout.should =~ /### Total private dirty RSS: [0-9\.]+ MB/ + + r.exit_code.should == 0 + end + end it 'should output status via passenger-status' do - shell("sudo /usr/bin/passenger-status") do |r| + shell("sudo PASSENGER_TMPDIR=/var/run/rubygem-passenger /usr/bin/passenger-status") do |r| # spacing may vary r.stdout.should =~ /[\-]+ General information [\-]+/ r.stdout.should =~ /max[ ]+= [0-9]+/ @@ -194,11 +207,11 @@ class { 'apache::mod::passenger': r.stdout.should =~ /active[ ]+= [0-9]+/ r.stdout.should =~ /inactive[ ]+= [0-9]+/ r.stdout.should =~ /Waiting on global queue: [0-9]+/ - + r.exit_code.should == 0 end end - + it 'should answer to passenger.example.com' do shell("/usr/bin/curl passenger.example.com:80") do |r| r.stdout.should =~ /^hello world<\/b>$/ diff --git a/spec/classes/mod/passenger_spec.rb b/spec/classes/mod/passenger_spec.rb index e65798a35..08cff4155 100644 --- a/spec/classes/mod/passenger_spec.rb +++ b/spec/classes/mod/passenger_spec.rb @@ -118,11 +118,16 @@ it { should contain_class("apache::params") } it { should contain_apache__mod('passenger') } it { should contain_package("mod_passenger") } + it { should contain_file('passenger_package.conf').with({ + 'path' => '/etc/httpd/conf.d/passenger.conf', + }) } + it { should contain_file('passenger_package.conf').without_content } + it { should contain_file('passenger_package.conf').without_source } it { should contain_file('passenger.load').with({ 'path' => '/etc/httpd/conf.d/passenger.load', }) } - it { should contain_file('passenger.conf').with_content(/^ PassengerRoot "\/usr\/lib\/ruby\/gems\/1.8\/gems\/passenger-3\.0\.19"$/) } - it { should contain_file('passenger.conf').with_content(/^ PassengerRuby "\/usr\/bin\/ruby"/) } + it { should contain_file('passenger.conf').without_content(/PassengerRoot/) } + it { should contain_file('passenger.conf').without_content(/PassengerRuby/) } describe "with passenger_root => '/usr/lib/example'" do let :params do { :passenger_root => '/usr/lib/example' }