From e49b77c68c5cbcb36072d220e3432a5f20b3f35f Mon Sep 17 00:00:00 2001 From: Ben Sandberg Date: Thu, 23 Oct 2014 14:06:21 -0700 Subject: [PATCH 1/9] passenger concat needs to be wrapped in a check --- manifests/vhost.pp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/manifests/vhost.pp b/manifests/vhost.pp index fd942fe5e..0841dfff4 100644 --- a/manifests/vhost.pp +++ b/manifests/vhost.pp @@ -795,10 +795,12 @@ # - $passenger_min_instances # - $passenger_start_timeout # - $passenger_pre_start - concat::fragment { "${name}-passenger": - target => "${priority_real}-${filename}.conf", - order => 290, - content => template('apache/vhost/_passenger.erb'), + if $passenger_app_root or $passenger_ruby or $passenger_min_instances or $passenger_start_timeout or $passenger_pre_start { + concat::fragment { "${name}-passenger": + target => "${priority_real}-${filename}.conf", + order => 290, + content => template('apache/vhost/_passenger.erb'), + } } # Template uses: From 95426e5f2bc43ae99205f0d10afbea3e82301b5e Mon Sep 17 00:00:00 2001 From: Morgan Haskel Date: Mon, 29 Sep 2014 15:03:20 -0500 Subject: [PATCH 2/9] Updates to mod::fcgid test don't work on RHEL5 --- spec/acceptance/mod_fcgid_spec.rb | 97 +++++++++++++++---------------- 1 file changed, 46 insertions(+), 51 deletions(-) diff --git a/spec/acceptance/mod_fcgid_spec.rb b/spec/acceptance/mod_fcgid_spec.rb index 8e94fa08f..2511b46ce 100644 --- a/spec/acceptance/mod_fcgid_spec.rb +++ b/spec/acceptance/mod_fcgid_spec.rb @@ -1,62 +1,57 @@ require 'spec_helper_acceptance' describe 'apache::mod::fcgid class', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do - case fact('osfamily') - when 'Debian' - # Not implemented - when 'RedHat' - context "default fcgid config" do - it 'succeeds in puppeting fcgid' do - pp = <<-EOS - class { 'epel': } # mod_fcgid lives in epel - class { 'apache': } - class { 'apache::mod::php': } # For /usr/bin/php-cgi - class { 'apache::mod::fcgid': - options => { - 'FcgidIPCDir' => '/var/run/fcgidsock', + context "default fcgid config", :if => (fact('osfamily') == 'RedHat' and fact('operatingsystemmajrelease') != '5') do + it 'succeeds in puppeting fcgid' do + pp = <<-EOS + class { 'epel': } # mod_fcgid lives in epel + class { 'apache': } + class { 'apache::mod::php': } # For /usr/bin/php-cgi + class { 'apache::mod::fcgid': + options => { + 'FcgidIPCDir' => '/var/run/fcgidsock', + }, + } + apache::vhost { 'fcgid.example.com': + port => '80', + docroot => '/var/www/fcgid', + directories => { + path => '/var/www/fcgid', + options => '+ExecCGI', + addhandlers => { + handler => 'fcgid-script', + extensions => '.php', }, - } - apache::vhost { 'fcgid.example.com': - port => '80', - docroot => '/var/www/fcgid', - directories => { - path => '/var/www/fcgid', - options => '+ExecCGI', - addhandlers => { - handler => 'fcgid-script', - extensions => '.php', - }, - fcgiwrapper => { - command => '/usr/bin/php-cgi', - suffix => '.php', - } - }, - } - file { '/var/www/fcgid/index.php': - ensure => file, - owner => 'root', - group => 'root', - content => "\\n", - } - EOS - apply_manifest(pp, :catch_failures => true) - end + fcgiwrapper => { + command => '/usr/bin/php-cgi', + suffix => '.php', + } + }, + } + file { '/var/www/fcgid/index.php': + ensure => file, + owner => 'root', + group => 'root', + content => "\\n", + } + EOS + apply_manifest(pp, :catch_failures => true) + end - describe service('httpd') do - it { is_expected.to be_enabled } - it { is_expected.to be_running } - end + describe service('httpd') do + it { is_expected.to be_enabled } + it { is_expected.to be_running } + end - it 'should answer to fcgid.example.com' do - shell("/usr/bin/curl -H 'Host: fcgid.example.com' 127.0.0.1:80") do |r| - expect(r.stdout).to match(/^Hello world$/) - expect(r.exit_code).to eq(0) - end + it 'should answer to fcgid.example.com' do + shell("/usr/bin/curl -H 'Host: fcgid.example.com' 127.0.0.1:80") do |r| + expect(r.stdout).to match(/^Hello world$/) + expect(r.exit_code).to eq(0) end + end - it 'should run a php-cgi process' do - shell("pgrep -u apache php-cgi", :acceptable_exit_codes => [0]) - end + it 'should run a php-cgi process' do + shell("pgrep -u apache php-cgi", :acceptable_exit_codes => [0]) end end end From ccb07c6a613821756ab784e7204f43e89915ece0 Mon Sep 17 00:00:00 2001 From: Morgan Haskel Date: Mon, 29 Sep 2014 15:25:21 -0500 Subject: [PATCH 3/9] Fix custom_config check for ubuntu precise. --- manifests/custom_config.pp | 2 +- manifests/params.pp | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/manifests/custom_config.pp b/manifests/custom_config.pp index 543ace94e..cadc2354d 100644 --- a/manifests/custom_config.pp +++ b/manifests/custom_config.pp @@ -5,7 +5,7 @@ $content = undef, $priority = '25', $source = undef, - $verify_command = '/usr/sbin/apachectl -t', + $verify_command = $::apache::params::verify_command, $verify_config = true, ) { diff --git a/manifests/params.pp b/manifests/params.pp index fc9a86e32..d8922e9fd 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -28,6 +28,11 @@ # The default error log level $log_level = 'warn' + if $::operatingsystem == 'Ubuntu' and $::lsbdistrelease == '10.04' { + $verify_command = '/usr/sbin/apache2ctl -t' + } else { + $verify_command = '/usr/sbin/apachectl -t' + } if $::osfamily == 'RedHat' or $::operatingsystem == 'amazon' { $user = 'apache' $group = 'apache' From bb849cdec4330dd68b3b85b072bf2cf72d87b6c5 Mon Sep 17 00:00:00 2001 From: Morgan Haskel Date: Mon, 29 Sep 2014 16:15:04 -0500 Subject: [PATCH 4/9] Fix dav_svn for debian 6 --- manifests/mod/dav_svn.pp | 25 ++++++++++++++----------- spec/acceptance/mod_dav_svn_spec.rb | 6 +++++- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/manifests/mod/dav_svn.pp b/manifests/mod/dav_svn.pp index c46976e85..36af06fa4 100644 --- a/manifests/mod/dav_svn.pp +++ b/manifests/mod/dav_svn.pp @@ -1,17 +1,20 @@ class apache::mod::dav_svn ( $authz_svn_enabled = false, ) { - Class['::apache::mod::dav'] -> Class['::apache::mod::dav_svn'] - include ::apache::mod::dav - ::apache::mod { 'dav_svn': } + Class['::apache::mod::dav'] -> Class['::apache::mod::dav_svn'] + include ::apache::mod::dav + ::apache::mod { 'dav_svn': } - if $authz_svn_enabled { - ::apache::mod { 'authz_svn': - loadfile_name => $::osfamily ? { - 'Debian' => undef, - default => 'dav_svn_authz_svn.load', - }, - require => Apache::Mod['dav_svn'], - } + if $::osfamily == 'Debian' and $::operatingsystemmajrelease != '6' { + $loadfile_name = undef + } else { + $loadfile_name = 'dav_svn_authz_svn.load' + } + + if $authz_svn_enabled { + ::apache::mod { 'authz_svn': + loadfile_name => $loadfile_name, + require => Apache::Mod['dav_svn'], } + } } diff --git a/spec/acceptance/mod_dav_svn_spec.rb b/spec/acceptance/mod_dav_svn_spec.rb index 5125ada0b..90e0db563 100644 --- a/spec/acceptance/mod_dav_svn_spec.rb +++ b/spec/acceptance/mod_dav_svn_spec.rb @@ -5,7 +5,11 @@ when 'Debian' mod_dir = '/etc/apache2/mods-available' service_name = 'apache2' - authz_svn_load_file = 'authz_svn.load' + if fact('operatingsystemmajrelease') == '6' + authz_svn_load_file = 'dav_svn_authz_svn.load' + else + authz_svn_load_file = 'authz_svn.load' + end when 'RedHat' mod_dir = '/etc/httpd/conf.d' service_name = 'httpd' From 4fe8892df667ee650b9980fb6d0af6203e2b5e20 Mon Sep 17 00:00:00 2001 From: Morgan Haskel Date: Mon, 29 Sep 2014 18:10:42 -0500 Subject: [PATCH 5/9] Fix vhost and mod_passenger tests on deb7 Also fix broken tests with strict variables. --- README.md | 2 ++ spec/acceptance/mod_passenger_spec.rb | 4 +-- spec/acceptance/vhost_spec.rb | 3 ++ spec/classes/mod/dav_svn_spec.rb | 47 ++++++++++++++------------- 4 files changed, 32 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index ba805b8cb..28c541d44 100644 --- a/README.md +++ b/README.md @@ -1745,6 +1745,8 @@ Creates URL [`rewrites`](#rewrites) rules in vhost directories. Expects an array } ``` +***Note*** If you include rewrites in your directories make sure you are also including `apache::mod::rewrite`. You may also want to consider setting the rewrites using the `rewrites` parameter in `apache::vhost` rather than setting the rewrites in the vhost directories. + ######`shib_request_setting` Allows an valid content setting to be set or altered for the application request. This command takes two parameters, the name of the content setting, and the value to set it to.Check the Shibboleth [content setting documentation](https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPContentSettings) for valid settings. This key is disabled if `apache::mod::shib` is not defined. Check the [`mod_shib` documentation](https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPApacheConfig#NativeSPApacheConfig-Server/VirtualHostOptions) for more details. diff --git a/spec/acceptance/mod_passenger_spec.rb b/spec/acceptance/mod_passenger_spec.rb index d14132234..9a758a44e 100644 --- a/spec/acceptance/mod_passenger_spec.rb +++ b/spec/acceptance/mod_passenger_spec.rb @@ -137,7 +137,7 @@ class { 'apache::mod::passenger': } end it 'should output status via passenger-memory-stats' do - shell("sudo /usr/sbin/passenger-memory-stats") do |r| + shell("/usr/sbin/passenger-memory-stats") do |r| expect(r.stdout).to match(/Apache processes/) expect(r.stdout).to match(/Nginx processes/) expect(r.stdout).to match(/Passenger processes/) @@ -262,7 +262,7 @@ class { 'apache::mod::passenger': end it 'should output status via passenger-memory-stats' do - shell("sudo /usr/bin/passenger-memory-stats", :pty => true) do |r| + shell("/usr/bin/passenger-memory-stats", :pty => true) do |r| expect(r.stdout).to match(/Apache processes/) expect(r.stdout).to match(/Nginx processes/) expect(r.stdout).to match(/Passenger processes/) diff --git a/spec/acceptance/vhost_spec.rb b/spec/acceptance/vhost_spec.rb index 08c717fc9..d45eaee9f 100644 --- a/spec/acceptance/vhost_spec.rb +++ b/spec/acceptance/vhost_spec.rb @@ -991,6 +991,9 @@ class { 'apache': } pp = <<-EOS class { 'apache': } host { 'test.server': ip => '127.0.0.1' } + if ! defined(Class['apache::mod::rewrite']) { + include ::apache::mod::rewrite + } apache::vhost { 'test.server': docroot => '/tmp', directories => [ diff --git a/spec/classes/mod/dav_svn_spec.rb b/spec/classes/mod/dav_svn_spec.rb index 859174af7..95abef994 100644 --- a/spec/classes/mod/dav_svn_spec.rb +++ b/spec/classes/mod/dav_svn_spec.rb @@ -7,14 +7,15 @@ context "on a Debian OS" do let :facts do { - :lsbdistcodename => 'squeeze', - :osfamily => 'Debian', - :operatingsystemrelease => '6', - :concat_basedir => '/dne', - :operatingsystem => 'Debian', - :id => 'root', - :kernel => 'Linux', - :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', + :lsbdistcodename => 'squeeze', + :osfamily => 'Debian', + :operatingsystemrelease => '6', + :operatingsystemmajrelease => '6', + :concat_basedir => '/dne', + :operatingsystem => 'Debian', + :id => 'root', + :kernel => 'Linux', + :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end it { is_expected.to contain_class("apache::params") } @@ -24,13 +25,14 @@ context "on a RedHat OS" do let :facts do { - :osfamily => 'RedHat', - :operatingsystemrelease => '6', - :concat_basedir => '/dne', - :operatingsystem => 'RedHat', - :id => 'root', - :kernel => 'Linux', - :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', + :osfamily => 'RedHat', + :operatingsystemrelease => '6', + :operatingsystemmajrelease => '6', + :concat_basedir => '/dne', + :operatingsystem => 'RedHat', + :id => 'root', + :kernel => 'Linux', + :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end it { is_expected.to contain_class("apache::params") } @@ -40,13 +42,14 @@ context "on a FreeBSD OS" do let :facts do { - :osfamily => 'FreeBSD', - :operatingsystemrelease => '9', - :concat_basedir => '/dne', - :operatingsystem => 'FreeBSD', - :id => 'root', - :kernel => 'Linux', - :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', + :osfamily => 'FreeBSD', + :operatingsystemrelease => '9', + :operatingsystemmajrelease => '9', + :concat_basedir => '/dne', + :operatingsystem => 'FreeBSD', + :id => 'root', + :kernel => 'Linux', + :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end it { is_expected.to contain_class("apache::params") } From 1be599daf1aa1da5e591a506f7fb43f2e21ea36b Mon Sep 17 00:00:00 2001 From: Morgan Haskel Date: Tue, 30 Sep 2014 14:41:14 -0500 Subject: [PATCH 6/9] Need fcgid to load after unixd on RHEL7 --- manifests/mod/fcgid.pp | 10 ++++- spec/classes/mod/fcgid_spec.rb | 71 +++++++++++++++++++++++----------- 2 files changed, 58 insertions(+), 23 deletions(-) diff --git a/manifests/mod/fcgid.pp b/manifests/mod/fcgid.pp index 70997768b..70761e41d 100644 --- a/manifests/mod/fcgid.pp +++ b/manifests/mod/fcgid.pp @@ -1,7 +1,15 @@ class apache::mod::fcgid( $options = {}, ) { - ::apache::mod { 'fcgid': } + if $::osfamily == 'RedHat' and $::operatingsystemmajrelease == '7' { + $loadfile_name = 'unixd_fcgid.load' + } else { + $loadfile_name = undef + } + + ::apache::mod { 'fcgid': + loadfile_name => $loadfile_name + } # Template uses: # - $options diff --git a/spec/classes/mod/fcgid_spec.rb b/spec/classes/mod/fcgid_spec.rb index ab47a5a8e..a342e5813 100644 --- a/spec/classes/mod/fcgid_spec.rb +++ b/spec/classes/mod/fcgid_spec.rb @@ -8,14 +8,15 @@ context "on a Debian OS" do let :facts do { - :osfamily => 'Debian', - :operatingsystemrelease => '6', - :concat_basedir => '/dne', - :lsbdistcodename => 'squeeze', - :operatingsystem => 'Debian', - :id => 'root', - :kernel => 'Linux', - :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', + :osfamily => 'Debian', + :operatingsystemrelease => '6', + :operatingsystemmajrelease => '6', + :concat_basedir => '/dne', + :lsbdistcodename => 'squeeze', + :operatingsystem => 'Debian', + :id => 'root', + :kernel => 'Linux', + :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end it { is_expected.to contain_class("apache::params") } @@ -26,13 +27,14 @@ context "on a RedHat OS" do let :facts do { - :osfamily => 'RedHat', - :operatingsystemrelease => '6', - :concat_basedir => '/dne', - :operatingsystem => 'RedHat', - :id => 'root', - :kernel => 'Linux', - :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', + :osfamily => 'RedHat', + :operatingsystemrelease => '6', + :operatingsystemmajrelease => '6', + :concat_basedir => '/dne', + :operatingsystem => 'RedHat', + :id => 'root', + :kernel => 'Linux', + :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end @@ -66,16 +68,41 @@ end end + context "on RHEL7" do + let :facts do + { + :osfamily => 'RedHat', + :operatingsystemrelease => '7', + :operatingsystemmajrelease => '7', + :concat_basedir => '/dne', + :operatingsystem => 'RedHat', + :id => 'root', + :kernel => 'Linux', + :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', + } + end + + describe 'without parameters' do + it { is_expected.to contain_class("apache::params") } + it { is_expected.to contain_apache__mod('fcgid').with({ + 'loadfile_name' => 'unixd_fcgid.load' + }) + } + it { is_expected.to contain_package("mod_fcgid") } + end + end + context "on a FreeBSD OS" do let :facts do { - :osfamily => 'FreeBSD', - :operatingsystemrelease => '9', - :concat_basedir => '/dne', - :operatingsystem => 'FreeBSD', - :id => 'root', - :kernel => 'FreeBSD', - :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', + :osfamily => 'FreeBSD', + :operatingsystemrelease => '9', + :operatingsystemmajrelease => '9', + :concat_basedir => '/dne', + :operatingsystem => 'FreeBSD', + :id => 'root', + :kernel => 'FreeBSD', + :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', } end From 56f884f00e93298adf15058e1b7ad4475b448669 Mon Sep 17 00:00:00 2001 From: Morgan Haskel Date: Mon, 20 Oct 2014 10:34:06 -0700 Subject: [PATCH 7/9] Remove OEL5 --- metadata.json | 1 - 1 file changed, 1 deletion(-) diff --git a/metadata.json b/metadata.json index f84ff41b8..3063ccf64 100644 --- a/metadata.json +++ b/metadata.json @@ -27,7 +27,6 @@ { "operatingsystem": "OracleLinux", "operatingsystemrelease": [ - "5", "6", "7" ] From 9d4bb7c9351fc88923983f67675b266726a45445 Mon Sep 17 00:00:00 2001 From: Morgan Haskel Date: Mon, 20 Oct 2014 14:38:54 -0700 Subject: [PATCH 8/9] Update loadfile name for Ubuntu 10.04 --- manifests/mod/dav_svn.pp | 2 +- spec/acceptance/mod_dav_svn_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/mod/dav_svn.pp b/manifests/mod/dav_svn.pp index 36af06fa4..d13a7d886 100644 --- a/manifests/mod/dav_svn.pp +++ b/manifests/mod/dav_svn.pp @@ -5,7 +5,7 @@ include ::apache::mod::dav ::apache::mod { 'dav_svn': } - if $::osfamily == 'Debian' and $::operatingsystemmajrelease != '6' { + if $::osfamily == 'Debian' and ($::operatingsystemmajrelease != '6' and $::operatingsystemmajrelease != '10.04') { $loadfile_name = undef } else { $loadfile_name = 'dav_svn_authz_svn.load' diff --git a/spec/acceptance/mod_dav_svn_spec.rb b/spec/acceptance/mod_dav_svn_spec.rb index 90e0db563..28cd5705f 100644 --- a/spec/acceptance/mod_dav_svn_spec.rb +++ b/spec/acceptance/mod_dav_svn_spec.rb @@ -5,7 +5,7 @@ when 'Debian' mod_dir = '/etc/apache2/mods-available' service_name = 'apache2' - if fact('operatingsystemmajrelease') == '6' + if fact('operatingsystemmajrelease') == '6' or fact('operatingsystemmajrelease') == '10.04' authz_svn_load_file = 'dav_svn_authz_svn.load' else authz_svn_load_file = 'authz_svn.load' From 1f9aaad9ff55451cf2b18bdfaaf25f9bce39c364 Mon Sep 17 00:00:00 2001 From: Morgan Haskel Date: Tue, 21 Oct 2014 15:50:32 -0700 Subject: [PATCH 9/9] OEL7 packaging has some issues This makes mod_dav_svn and mod_fcgid unable to install. --- spec/acceptance/mod_dav_svn_spec.rb | 2 +- spec/acceptance/mod_fcgid_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/acceptance/mod_dav_svn_spec.rb b/spec/acceptance/mod_dav_svn_spec.rb index 28cd5705f..189bb15c4 100644 --- a/spec/acceptance/mod_dav_svn_spec.rb +++ b/spec/acceptance/mod_dav_svn_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper_acceptance' -describe 'apache::mod::dav_svn class' do +describe 'apache::mod::dav_svn class', :unless => (fact('operatingsystem') == 'OracleLinux' and fact('operatingsystemmajrelease') == '7') do case fact('osfamily') when 'Debian' mod_dir = '/etc/apache2/mods-available' diff --git a/spec/acceptance/mod_fcgid_spec.rb b/spec/acceptance/mod_fcgid_spec.rb index 2511b46ce..e99a7f299 100644 --- a/spec/acceptance/mod_fcgid_spec.rb +++ b/spec/acceptance/mod_fcgid_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper_acceptance' -describe 'apache::mod::fcgid class', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do +describe 'apache::mod::fcgid class', :unless => (UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) or (fact('operatingsystem') == 'OracleLinux' and fact('operatingsystemmajrelease') == '7')) do context "default fcgid config", :if => (fact('osfamily') == 'RedHat' and fact('operatingsystemmajrelease') != '5') do it 'succeeds in puppeting fcgid' do pp = <<-EOS