diff --git a/manifests/params.pp b/manifests/params.pp index 29e9fd2fc..c7a042a7d 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -90,36 +90,36 @@ $mime_support_package = 'mailcap' $mime_types_config = '/etc/mime.types' } elsif $::osfamily == 'Debian' { - $user = 'www-data' - $group = 'www-data' - $root_group = 'root' - $apache_name = 'apache2' - $service_name = 'apache2' - $httpd_dir = '/etc/apache2' - $server_root = '/etc/apache2' - $conf_dir = $httpd_dir - $confd_dir = "${httpd_dir}/conf.d" - $mod_dir = "${httpd_dir}/mods-available" - $mod_enable_dir = "${httpd_dir}/mods-enabled" - $vhost_dir = "${httpd_dir}/sites-available" - $vhost_enable_dir = "${httpd_dir}/sites-enabled" - $conf_file = 'apache2.conf' - $ports_file = "${conf_dir}/ports.conf" - $logroot = '/var/log/apache2' - $lib_path = '/usr/lib/apache2/modules' - $mpm_module = 'worker' - $dev_packages = ['libaprutil1-dev', 'libapr1-dev', 'apache2-prefork-dev'] - $default_ssl_cert = '/etc/ssl/certs/ssl-cert-snakeoil.pem' - $default_ssl_key = '/etc/ssl/private/ssl-cert-snakeoil.key' - $ssl_certs_dir = '/etc/ssl/certs' - $passenger_conf_file = 'passenger.conf' - $passenger_conf_package_file = undef - $passenger_root = '/usr' - $passenger_ruby = '/usr/bin/ruby' - $suphp_addhandler = 'x-httpd-php' - $suphp_engine = 'off' - $suphp_configpath = '/etc/php5/apache2' - $mod_packages = { + $user = 'www-data' + $group = 'www-data' + $root_group = 'root' + $apache_name = 'apache2' + $service_name = 'apache2' + $httpd_dir = '/etc/apache2' + $server_root = '/etc/apache2' + $conf_dir = $httpd_dir + $confd_dir = "${httpd_dir}/conf.d" + $mod_dir = "${httpd_dir}/mods-available" + $mod_enable_dir = "${httpd_dir}/mods-enabled" + $vhost_dir = "${httpd_dir}/sites-available" + $vhost_enable_dir = "${httpd_dir}/sites-enabled" + $conf_file = 'apache2.conf' + $ports_file = "${conf_dir}/ports.conf" + $logroot = '/var/log/apache2' + $lib_path = '/usr/lib/apache2/modules' + $mpm_module = 'worker' + $dev_packages = ['libaprutil1-dev', 'libapr1-dev', 'apache2-prefork-dev'] + $default_ssl_cert = '/etc/ssl/certs/ssl-cert-snakeoil.pem' + $default_ssl_key = '/etc/ssl/private/ssl-cert-snakeoil.key' + $ssl_certs_dir = '/etc/ssl/certs' + $passenger_conf_file = 'passenger_extra.conf' + $passenger_conf_package_file = 'passenger.conf' + $passenger_root = undef + $passenger_ruby = undef + $suphp_addhandler = 'x-httpd-php' + $suphp_engine = 'off' + $suphp_configpath = '/etc/php5/apache2' + $mod_packages = { 'auth_kerb' => 'libapache2-mod-auth-kerb', 'dav_svn' => 'libapache2-svn', 'fastcgi' => 'libapache2-mod-fastcgi', @@ -136,16 +136,16 @@ 'wsgi' => 'libapache2-mod-wsgi', 'xsendfile' => 'libapache2-mod-xsendfile', } - $mod_libs = { + $mod_libs = { 'php5' => 'libphp5.so', } - $conf_template = 'apache/httpd.conf.erb' - $keepalive = 'Off' - $keepalive_timeout = 15 + $conf_template = 'apache/httpd.conf.erb' + $keepalive = 'Off' + $keepalive_timeout = 15 $max_keepalive_requests = 100 - $fastcgi_lib_path = '/var/lib/apache2/fastcgi' + $fastcgi_lib_path = '/var/lib/apache2/fastcgi' $mime_support_package = 'mime-support' - $mime_types_config = '/etc/mime.types' + $mime_types_config = '/etc/mime.types' } elsif $::osfamily == 'FreeBSD' { $user = 'www' $group = 'www' diff --git a/spec/acceptance/mod_passenger_spec.rb b/spec/acceptance/mod_passenger_spec.rb index e1ea23ec8..5b6c6d857 100644 --- a/spec/acceptance/mod_passenger_spec.rb +++ b/spec/acceptance/mod_passenger_spec.rb @@ -5,7 +5,7 @@ when 'Debian' service_name = 'apache2' mod_dir = '/etc/apache2/mods-available/' - conf_file = "#{mod_dir}passenger.conf" + conf_file = "#{mod_dir}passenger_extra.conf" load_file = "#{mod_dir}passenger.load" passenger_root = '/usr' passenger_ruby = '/usr/bin/ruby' @@ -71,8 +71,9 @@ class { 'apache::mod::passenger': } end describe file(conf_file) do - it { should contain "PassengerRoot \"#{passenger_root}\"" } - it { should contain "PassengerRuby \"#{passenger_ruby}\"" } + # passenger_extra.conf only contains directives if overridden from the class params + it { should_not contain "PassengerRoot \"#{passenger_root}\"" } + it { should_not contain "PassengerRuby \"#{passenger_ruby}\"" } end describe file(load_file) do @@ -99,11 +100,17 @@ class { 'apache::mod::passenger': } shell("sudo /usr/sbin/passenger-status") do |r| # spacing may vary r.stdout.should =~ /[\-]+ General information [\-]+/ - r.stdout.should =~ /max[ ]+= [0-9]+/ - r.stdout.should =~ /count[ ]+= [0-9]+/ - r.stdout.should =~ /active[ ]+= [0-9]+/ - r.stdout.should =~ /inactive[ ]+= [0-9]+/ - r.stdout.should =~ /Waiting on global queue: [0-9]+/ + if fact('operatingsystem') == 'Ubuntu' && fact('operatingsystemrelease') == '14.04' + r.stdout.should =~ /Max pool size[ ]+: [0-9]+/ + r.stdout.should =~ /Processes[ ]+: [0-9]+/ + r.stdout.should =~ /Requests in top-level queue[ ]+: [0-9]+/ + else + r.stdout.should =~ /max[ ]+= [0-9]+/ + r.stdout.should =~ /count[ ]+= [0-9]+/ + r.stdout.should =~ /active[ ]+= [0-9]+/ + r.stdout.should =~ /inactive[ ]+= [0-9]+/ + r.stdout.should =~ /Waiting on global queue: [0-9]+/ + end r.exit_code.should == 0 end diff --git a/spec/classes/mod/passenger_spec.rb b/spec/classes/mod/passenger_spec.rb index 08cff4155..608b3c47d 100644 --- a/spec/classes/mod/passenger_spec.rb +++ b/spec/classes/mod/passenger_spec.rb @@ -16,11 +16,28 @@ it { should contain_file('passenger.load').with({ 'path' => '/etc/apache2/mods-available/passenger.load', }) } - it { should contain_file('passenger.conf').with({ + it { should contain_file('passenger_package.conf').with({ 'path' => '/etc/apache2/mods-available/passenger.conf', }) } - it { should contain_file('passenger.conf').with_content(/^ PassengerRoot "\/usr"$/) } - it { should contain_file('passenger.conf').with_content(/^ PassengerRuby "\/usr\/bin\/ruby"$/) } + it { should contain_file('passenger_package.conf').without_content } + it { should contain_file('passenger_package.conf').without_source } + it { should contain_file('passenger.conf').with({ + 'path' => '/etc/apache2/mods-available/passenger_extra.conf', + }) } + 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' } + end + it { should contain_file('passenger.conf').with_content(%r{PassengerRoot "/usr/lib/example"}) } + end + describe "with passenger_ruby => /usr/lib/example/ruby" do + let :params do + { :passenger_ruby => '/usr/lib/example/ruby' } + end + it { should contain_file('passenger.conf').with_content(%r{PassengerRuby "/usr/lib/example/ruby"}) } + end describe "with passenger_high_performance => true" do let :params do { :passenger_high_performance => 'true' } @@ -69,11 +86,11 @@ end it { should contain_file('passenger.conf').with_content(/^ PassengerRoot "\/usr\/lib\/example"$/) } end - describe "with passenger_ruby => /user/lib/example/ruby" do + describe "with passenger_ruby => /usr/lib/example/ruby" do let :params do - { :passenger_ruby => '/user/lib/example/ruby' } + { :passenger_ruby => '/usr/lib/example/ruby' } end - it { should contain_file('passenger.conf').with_content(/^ PassengerRuby "\/user\/lib\/example\/ruby"$/) } + it { should contain_file('passenger.conf').with_content(/^ PassengerRuby "\/usr\/lib\/example\/ruby"$/) } end describe "with passenger_use_global_queue => true" do let :params do @@ -134,11 +151,11 @@ end it { should contain_file('passenger.conf').with_content(/^ PassengerRoot "\/usr\/lib\/example"$/) } end - describe "with passenger_ruby => /user/lib/example/ruby" do + describe "with passenger_ruby => /usr/lib/example/ruby" do let :params do - { :passenger_ruby => '/user/lib/example/ruby' } + { :passenger_ruby => '/usr/lib/example/ruby' } end - it { should contain_file('passenger.conf').with_content(/^ PassengerRuby "\/user\/lib\/example\/ruby"$/) } + it { should contain_file('passenger.conf').with_content(/^ PassengerRuby "\/usr\/lib\/example\/ruby"$/) } end end context "on a FreeBSD OS" do