diff --git a/manifests/mod/event.pp b/manifests/mod/event.pp index 42d646866c..864b50f4a1 100644 --- a/manifests/mod/event.pp +++ b/manifests/mod/event.pp @@ -86,7 +86,12 @@ 'listenbacklog' => $listenbacklog, } - file { "${apache::mod_dir}/event.conf": + $eventconffile = $facts['os']['family'] ? { + 'Debian' => "${apache::mod_dir}/mpm_event.conf", + default => "${apache::mod_dir}/event.conf", + } + + file { $eventconffile: ensure => file, mode => $apache::file_mode, content => epp('apache/mod/event.conf.epp', $parameters), diff --git a/manifests/mod/itk.pp b/manifests/mod/itk.pp index 96940d8593..80c0e62d78 100644 --- a/manifests/mod/itk.pp +++ b/manifests/mod/itk.pp @@ -79,7 +79,12 @@ 'enablecapabilities' => $enablecapabilities, } - file { "${apache::mod_dir}/itk.conf": + $itkconffile = $facts['os']['family'] ? { + 'Debian' => "${apache::mod_dir}/mpm_itk.conf", + default => "${apache::mod_dir}/itk.conf", + } + + file { $itkconffile: ensure => file, mode => $apache::file_mode, content => epp('apache/mod/itk.conf.epp', $parameters), diff --git a/manifests/mod/prefork.pp b/manifests/mod/prefork.pp index 1138d8314b..932e4e6801 100644 --- a/manifests/mod/prefork.pp +++ b/manifests/mod/prefork.pp @@ -79,7 +79,12 @@ 'listenbacklog' => $listenbacklog, } - file { "${apache::mod_dir}/prefork.conf": + $preforkconffile = $facts['os']['family'] ? { + 'Debian' => "${apache::mod_dir}/mpm_prefork.conf", + default => "${apache::mod_dir}/prefork.conf", + } + + file { $preforkconffile: ensure => file, content => epp('apache/mod/prefork.conf.epp', $parameters), require => Exec["mkdir ${apache::mod_dir}"], diff --git a/manifests/mod/worker.pp b/manifests/mod/worker.pp index 42fd52933f..537ab97582 100644 --- a/manifests/mod/worker.pp +++ b/manifests/mod/worker.pp @@ -90,7 +90,12 @@ 'maxrequestworkers' => $maxrequestworkers, } - file { "${apache::mod_dir}/worker.conf": + $workerconffile = $facts['os']['family'] ? { + 'Debian' => "${apache::mod_dir}/mpm_worker.conf", + default => "${apache::mod_dir}/worker.conf", + } + + file { $workerconffile: ensure => file, content => epp('apache/mod/worker.conf.epp', $parameters), require => Exec["mkdir ${apache::mod_dir}"], diff --git a/manifests/mpm.pp b/manifests/mpm.pp index d4b15853d2..4ab38676ba 100644 --- a/manifests/mpm.pp +++ b/manifests/mpm.pp @@ -15,49 +15,48 @@ $_path = "${lib_path}/${_lib}" $_id = "mpm_${mpm}_module" - if $facts['os']['family'] == 'Suse' { - #mpms on Suse 12 don't use .so libraries so create a placeholder load file - file { "${mod_dir}/${mpm}.load": - ensure => file, - path => "${mod_dir}/${mpm}.load", - content => '', - require => [ - Package['httpd'], - Exec["mkdir ${mod_dir}"], - ], - before => File[$mod_dir], - notify => Class['apache::service'], + if $facts['os']['family'] == 'Debian' { + $mpm_modules = ['mpm_event', 'mpm_worker', 'mpm_prefork'] - "mpm_${mpm}" + $mpmloadfile = "${mod_dir}/mpm_${mpm}.load" + $mpmloadcontent = $mpm ? { + /(event|prefork|worker)/ => "# Conflicts: ${join($mpm_modules, ' ')}\nLoadModule ${_id} ${_path}\n", + 'itk' => "# Depends: mpm_prefork\nLoadModule ${_id} ${_path}\n", } } else { - file { "${mod_dir}/${mpm}.load": - ensure => file, - path => "${mod_dir}/${mpm}.load", - content => "LoadModule ${_id} ${_path}\n", - require => [ - Package['httpd'], - Exec["mkdir ${mod_dir}"], - ], - before => File[$mod_dir], - notify => Class['apache::service'], + $mpmloadfile = "${mod_dir}/${mpm}.load" + $mpmloadcontent = $facts['os']['family'] ? { + 'Suse' => '', + default => "LoadModule ${_id} ${_path}\n" } } + file { $mpmloadfile: + ensure => file, + path => $mpmloadfile, + content => $mpmloadcontent, + require => [ + Package['httpd'], + Exec["mkdir ${mod_dir}"], + ], + before => File[$mod_dir], + notify => Class['apache::service'], + } + case $facts['os']['family'] { 'Debian': { - file { "${apache::mod_enable_dir}/${mpm}.conf": - ensure => link, - target => "${apache::mod_dir}/${mpm}.conf", - require => Exec["mkdir ${apache::mod_enable_dir}"], - before => File[$apache::mod_enable_dir], - notify => Class['apache::service'], - } - - file { "${apache::mod_enable_dir}/${mpm}.load": - ensure => link, - target => "${apache::mod_dir}/${mpm}.load", - require => Exec["mkdir ${apache::mod_enable_dir}"], - before => File[$apache::mod_enable_dir], - notify => Class['apache::service'], + file { + default: + ensure => link, + require => Exec["mkdir ${apache::mod_enable_dir}"], + before => File[$apache::mod_enable_dir], + notify => Class['apache::service'], + ; + "${apache::mod_enable_dir}/mpm_${mpm}.conf": + target => "../mods-available/mpm_${mpm}.conf", + ; + "${apache::mod_enable_dir}/mpm_${mpm}.load": + target => "../mods-available/mpm_${mpm}.load", + ; } if $mpm == 'itk' { @@ -67,9 +66,7 @@ require => Package['httpd'], before => Class['apache::service'], } - } - if $mpm == 'itk' { package { 'libapache2-mpm-itk': ensure => present, before => [ @@ -91,33 +88,20 @@ include apache::mpm::disable_mpm_event } } - - 'FreeBSD': { - class { 'apache::package': - mpm_module => $mpm, - } - } - 'Gentoo': { - # so we don't fail - } - 'RedHat': { - # so we don't fail - } 'Suse': { - file { "${apache::mod_enable_dir}/${mpm}.conf": - ensure => link, - target => "${apache::mod_dir}/${mpm}.conf", - require => Exec["mkdir ${apache::mod_enable_dir}"], - before => File[$apache::mod_enable_dir], - notify => Class['apache::service'], - } - - file { "${apache::mod_enable_dir}/${mpm}.load": - ensure => link, - target => "${apache::mod_dir}/${mpm}.load", - require => Exec["mkdir ${apache::mod_enable_dir}"], - before => File[$apache::mod_enable_dir], - notify => Class['apache::service'], + file { + default: + ensure => link, + require => Exec["mkdir ${apache::mod_enable_dir}"], + before => File[$apache::mod_enable_dir], + notify => Class['apache::service'], + ; + "${apache::mod_enable_dir}/${mpm}.conf": + target => "${mod_dir}/${mpm}.conf", + ; + "${apache::mod_enable_dir}/${mpm}.load": + target => "${mod_dir}/${mpm}.load", + ; } if $mpm == 'itk' { @@ -131,6 +115,14 @@ ensure => present, } } + 'FreeBSD': { + class { 'apache::package': + mpm_module => $mpm, + } + } + 'Gentoo', 'RedHat': { + # so we don't fail + } default: { fail("Unsupported osfamily ${$facts['os']['family']}") } diff --git a/manifests/mpm/disable_mpm_event.pp b/manifests/mpm/disable_mpm_event.pp index faa04cfe8f..d2b2dc6fae 100644 --- a/manifests/mpm/disable_mpm_event.pp +++ b/manifests/mpm/disable_mpm_event.pp @@ -1,11 +1,14 @@ # @summary disable Apache-Module event class apache::mpm::disable_mpm_event { - $event_command = ['/usr/sbin/a2dismod', 'mpm_event'] - $event_onlyif = [['/usr/bin/test', '-e', join([$apache::mod_enable_dir, 'mpm_event.load'],'/')]] - exec { '/usr/sbin/a2dismod mpm_event': - command => $event_command, - onlyif => $event_onlyif, - require => Package['httpd'], - notify => Class['apache::service'], + $mod_names = ['event', 'mpm_event'] + $mod_names.each | $mod_name| { + $event_command = ['/usr/sbin/a2dismod', $mod_name] + $event_onlyif = [['/usr/bin/test', '-e', join([$apache::mod_enable_dir, "${mod_name}.load"],'/')]] + exec { "/usr/sbin/a2dismod ${mod_name}": + command => $event_command, + onlyif => $event_onlyif, + require => Package['httpd'], + notify => Class['apache::service'], + } } } diff --git a/manifests/mpm/disable_mpm_prefork.pp b/manifests/mpm/disable_mpm_prefork.pp index 1488276915..57be16e361 100644 --- a/manifests/mpm/disable_mpm_prefork.pp +++ b/manifests/mpm/disable_mpm_prefork.pp @@ -1,11 +1,14 @@ # @summary disable Apache-Module prefork class apache::mpm::disable_mpm_prefork { - $prefork_command = ['/usr/sbin/a2dismod', 'prefork'] - $prefork_onlyif = [['/usr/bin/test', '-e', join([$apache::mod_enable_dir, 'prefork.load'],'/')]] - exec { '/usr/sbin/a2dismod prefork': - command => $prefork_command, - onlyif => $prefork_onlyif, - require => Package['httpd'], - before => Class['apache::service'], + $mod_names = ['itk', 'mpm_itk', 'prefork', 'mpm_prefork'] + $mod_names.each | $mod_name| { + $prefork_command = ['/usr/sbin/a2dismod', $mod_name] + $prefork_onlyif = [['/usr/bin/test', '-e', join([$apache::mod_enable_dir, "${mod_name}.load"],'/')]] + exec { "/usr/sbin/a2dismod ${mod_name}": + command => $prefork_command, + onlyif => $prefork_onlyif, + require => Package['httpd'], + notify => Class['apache::service'], + } } } diff --git a/manifests/mpm/disable_mpm_worker.pp b/manifests/mpm/disable_mpm_worker.pp index 7da4a92ace..9f70c5b057 100644 --- a/manifests/mpm/disable_mpm_worker.pp +++ b/manifests/mpm/disable_mpm_worker.pp @@ -1,11 +1,14 @@ # @summary disable Apache-Module worker class apache::mpm::disable_mpm_worker { - $worker_command = ['/usr/sbin/a2dismod', 'worker'] - $worker_onlyif = [['/usr/bin/test', '-e', join([$apache::mod_enable_dir, 'worker.load'],'/')]] - exec { '/usr/sbin/a2dismod worker': - command => $worker_command, - onlyif => $worker_onlyif, - require => Package['httpd'], - before => Class['apache::service'], + $mod_names = ['worker', 'mpm_worker'] + $mod_names.each | $mod_name| { + $worker_command = ['/usr/sbin/a2dismod', $mod_name] + $worker_onlyif = [['/usr/bin/test', '-e', join([$apache::mod_enable_dir, "${mod_name}.load"],'/')]] + exec { "/usr/sbin/a2dismod ${mod_name}": + command => $worker_command, + onlyif => $worker_onlyif, + require => Package['httpd'], + notify => Class['apache::service'], + } } } diff --git a/spec/classes/mod/event_spec.rb b/spec/classes/mod/event_spec.rb index 39d83ae992..4a4697174e 100644 --- a/spec/classes/mod/event_spec.rb +++ b/spec/classes/mod/event_spec.rb @@ -25,11 +25,15 @@ context 'on a Debian OS' do include_examples 'Debian 11' + let(:loadcontent) do + "# Conflicts: mpm_worker mpm_prefork\n"\ + "LoadModule mpm_event_module /usr/lib/apache2/modules/mod_mpm_event.so\n" + end it { is_expected.to contain_class('apache::params') } it { is_expected.not_to contain_apache__mod('event') } - it { is_expected.to contain_file('/etc/apache2/mods-available/event.conf').with_ensure('file') } - it { is_expected.to contain_file('/etc/apache2/mods-enabled/event.conf').with_ensure('link') } + it { is_expected.to contain_file('/etc/apache2/mods-available/mpm_event.conf').with_ensure('file') } + it { is_expected.to contain_file('/etc/apache2/mods-enabled/mpm_event.conf').with_ensure('link') } context 'Test mpm_event new params' do let :params do @@ -46,15 +50,15 @@ } end - it { is_expected.to contain_file('/etc/apache2/mods-available/event.conf').with_ensure('file').with_content(%r{^\s*ServerLimit\s*0}) } - it { is_expected.to contain_file('/etc/apache2/mods-available/event.conf').with_ensure('file').with_content(%r{^\s*StartServers\s*1}) } - it { is_expected.to contain_file('/etc/apache2/mods-available/event.conf').with_ensure('file').with_content(%r{^\s*MinSpareThreads\s*3}) } - it { is_expected.to contain_file('/etc/apache2/mods-available/event.conf').with_ensure('file').with_content(%r{^\s*MaxSpareThreads\s*4}) } - it { is_expected.to contain_file('/etc/apache2/mods-available/event.conf').with_ensure('file').with_content(%r{^\s*ThreadsPerChild\s*5}) } - it { is_expected.to contain_file('/etc/apache2/mods-available/event.conf').with_ensure('file').with_content(%r{^\s*ThreadLimit\s*7}) } - it { is_expected.to contain_file('/etc/apache2/mods-available/event.conf').with_ensure('file').with_content(%r{^\s*ListenBacklog\s*8}) } - it { is_expected.to contain_file('/etc/apache2/mods-available/event.conf').with_ensure('file').with_content(%r{^\s*MaxRequestWorkers\s*9}) } - it { is_expected.to contain_file('/etc/apache2/mods-available/event.conf').with_ensure('file').with_content(%r{^\s*MaxConnectionsPerChild\s*10}) } + it { is_expected.to contain_file('/etc/apache2/mods-available/mpm_event.conf').with_ensure('file').with_content(%r{^\s*ServerLimit\s*0}) } + it { is_expected.to contain_file('/etc/apache2/mods-available/mpm_event.conf').with_ensure('file').with_content(%r{^\s*StartServers\s*1}) } + it { is_expected.to contain_file('/etc/apache2/mods-available/mpm_event.conf').with_ensure('file').with_content(%r{^\s*MinSpareThreads\s*3}) } + it { is_expected.to contain_file('/etc/apache2/mods-available/mpm_event.conf').with_ensure('file').with_content(%r{^\s*MaxSpareThreads\s*4}) } + it { is_expected.to contain_file('/etc/apache2/mods-available/mpm_event.conf').with_ensure('file').with_content(%r{^\s*ThreadsPerChild\s*5}) } + it { is_expected.to contain_file('/etc/apache2/mods-available/mpm_event.conf').with_ensure('file').with_content(%r{^\s*ThreadLimit\s*7}) } + it { is_expected.to contain_file('/etc/apache2/mods-available/mpm_event.conf').with_ensure('file').with_content(%r{^\s*ListenBacklog\s*8}) } + it { is_expected.to contain_file('/etc/apache2/mods-available/mpm_event.conf').with_ensure('file').with_content(%r{^\s*MaxRequestWorkers\s*9}) } + it { is_expected.to contain_file('/etc/apache2/mods-available/mpm_event.conf').with_ensure('file').with_content(%r{^\s*MaxConnectionsPerChild\s*10}) } end context 'Test mpm_event old style params' do @@ -72,15 +76,15 @@ } end - it { is_expected.to contain_file('/etc/apache2/mods-available/event.conf').with_ensure('file').with_content(%r{^\s*ServerLimit\s*0}) } - it { is_expected.to contain_file('/etc/apache2/mods-available/event.conf').with_ensure('file').with_content(%r{^\s*StartServers\s*1}) } - it { is_expected.to contain_file('/etc/apache2/mods-available/event.conf').with_ensure('file').with_content(%r{^\s*MinSpareThreads\s*3}) } - it { is_expected.to contain_file('/etc/apache2/mods-available/event.conf').with_ensure('file').with_content(%r{^\s*MaxSpareThreads\s*4}) } - it { is_expected.to contain_file('/etc/apache2/mods-available/event.conf').with_ensure('file').with_content(%r{^\s*ThreadsPerChild\s*5}) } - it { is_expected.to contain_file('/etc/apache2/mods-available/event.conf').with_ensure('file').with_content(%r{^\s*ThreadLimit\s*7}) } - it { is_expected.to contain_file('/etc/apache2/mods-available/event.conf').with_ensure('file').with_content(%r{^\s*ListenBacklog\s*8}) } - it { is_expected.to contain_file('/etc/apache2/mods-available/event.conf').with_ensure('file').without_content(%r{^\s*MaxRequestWorkers}) } - it { is_expected.to contain_file('/etc/apache2/mods-available/event.conf').with_ensure('file').without_content(%r{^\s*MaxConnectionsPerChild}) } + it { is_expected.to contain_file('/etc/apache2/mods-available/mpm_event.conf').with_ensure('file').with_content(%r{^\s*ServerLimit\s*0}) } + it { is_expected.to contain_file('/etc/apache2/mods-available/mpm_event.conf').with_ensure('file').with_content(%r{^\s*StartServers\s*1}) } + it { is_expected.to contain_file('/etc/apache2/mods-available/mpm_event.conf').with_ensure('file').with_content(%r{^\s*MinSpareThreads\s*3}) } + it { is_expected.to contain_file('/etc/apache2/mods-available/mpm_event.conf').with_ensure('file').with_content(%r{^\s*MaxSpareThreads\s*4}) } + it { is_expected.to contain_file('/etc/apache2/mods-available/mpm_event.conf').with_ensure('file').with_content(%r{^\s*ThreadsPerChild\s*5}) } + it { is_expected.to contain_file('/etc/apache2/mods-available/mpm_event.conf').with_ensure('file').with_content(%r{^\s*ThreadLimit\s*7}) } + it { is_expected.to contain_file('/etc/apache2/mods-available/mpm_event.conf').with_ensure('file').with_content(%r{^\s*ListenBacklog\s*8}) } + it { is_expected.to contain_file('/etc/apache2/mods-available/mpm_event.conf').with_ensure('file').without_content(%r{^\s*MaxRequestWorkers}) } + it { is_expected.to contain_file('/etc/apache2/mods-available/mpm_event.conf').with_ensure('file').without_content(%r{^\s*MaxConnectionsPerChild}) } end context 'Test mpm_event false params' do @@ -98,23 +102,23 @@ } end - it { is_expected.to contain_file('/etc/apache2/mods-available/event.conf').with_ensure('file').without_content(%r{^\s*ServerLimit}) } - it { is_expected.to contain_file('/etc/apache2/mods-available/event.conf').with_ensure('file').without_content(%r{^\s*StartServers}) } - it { is_expected.to contain_file('/etc/apache2/mods-available/event.conf').with_ensure('file').without_content(%r{^\s*MinSpareThreads}) } - it { is_expected.to contain_file('/etc/apache2/mods-available/event.conf').with_ensure('file').without_content(%r{^\s*MaxSpareThreads}) } - it { is_expected.to contain_file('/etc/apache2/mods-available/event.conf').with_ensure('file').without_content(%r{^\s*ThreadsPerChild}) } - it { is_expected.to contain_file('/etc/apache2/mods-available/event.conf').with_ensure('file').without_content(%r{^\s*ThreadLimit}) } - it { is_expected.to contain_file('/etc/apache2/mods-available/event.conf').with_ensure('file').without_content(%r{^\s*ListenBacklog}) } - it { is_expected.to contain_file('/etc/apache2/mods-available/event.conf').with_ensure('file').without_content(%r{^\s*MaxRequestWorkers}) } - it { is_expected.to contain_file('/etc/apache2/mods-available/event.conf').with_ensure('file').without_content(%r{^\s*MaxConnectionsPerChild}) } + it { is_expected.to contain_file('/etc/apache2/mods-available/mpm_event.conf').with_ensure('file').without_content(%r{^\s*ServerLimit}) } + it { is_expected.to contain_file('/etc/apache2/mods-available/mpm_event.conf').with_ensure('file').without_content(%r{^\s*StartServers}) } + it { is_expected.to contain_file('/etc/apache2/mods-available/mpm_event.conf').with_ensure('file').without_content(%r{^\s*MinSpareThreads}) } + it { is_expected.to contain_file('/etc/apache2/mods-available/mpm_event.conf').with_ensure('file').without_content(%r{^\s*MaxSpareThreads}) } + it { is_expected.to contain_file('/etc/apache2/mods-available/mpm_event.conf').with_ensure('file').without_content(%r{^\s*ThreadsPerChild}) } + it { is_expected.to contain_file('/etc/apache2/mods-available/mpm_event.conf').with_ensure('file').without_content(%r{^\s*ThreadLimit}) } + it { is_expected.to contain_file('/etc/apache2/mods-available/mpm_event.conf').with_ensure('file').without_content(%r{^\s*ListenBacklog}) } + it { is_expected.to contain_file('/etc/apache2/mods-available/mpm_event.conf').with_ensure('file').without_content(%r{^\s*MaxRequestWorkers}) } + it { is_expected.to contain_file('/etc/apache2/mods-available/mpm_event.conf').with_ensure('file').without_content(%r{^\s*MaxConnectionsPerChild}) } end it { - expect(subject).to contain_file('/etc/apache2/mods-available/event.load').with('ensure' => 'file', - 'content' => "LoadModule mpm_event_module /usr/lib/apache2/modules/mod_mpm_event.so\n") + expect(subject).to contain_file('/etc/apache2/mods-available/mpm_event.load').with('ensure' => 'file', + 'content' => loadcontent) } - it { is_expected.to contain_file('/etc/apache2/mods-enabled/event.load').with_ensure('link') } + it { is_expected.to contain_file('/etc/apache2/mods-enabled/mpm_event.load').with_ensure('link') } end context 'on a RedHat OS' do diff --git a/spec/classes/mod/itk_spec.rb b/spec/classes/mod/itk_spec.rb index 2ecf14f76f..74b77ce75e 100644 --- a/spec/classes/mod/itk_spec.rb +++ b/spec/classes/mod/itk_spec.rb @@ -9,11 +9,15 @@ context 'on a Debian OS' do include_examples 'Debian 11' + let(:loadcontent) do + "# Depends: mpm_prefork\n"\ + "LoadModule mpm_itk_module /usr/lib/apache2/modules/mod_mpm_itk.so\n" + end it { is_expected.to contain_class('apache::params') } it { is_expected.not_to contain_apache__mod('itk') } - it { is_expected.to contain_file('/etc/apache2/mods-available/itk.conf').with_ensure('file') } - it { is_expected.to contain_file('/etc/apache2/mods-enabled/itk.conf').with_ensure('link') } + it { is_expected.to contain_file('/etc/apache2/mods-available/mpm_itk.conf').with_ensure('file') } + it { is_expected.to contain_file('/etc/apache2/mods-enabled/mpm_itk.conf').with_ensure('link') } context 'with prefork mpm' do let :pre_condition do @@ -21,11 +25,11 @@ end it { - expect(subject).to contain_file('/etc/apache2/mods-available/itk.load').with('ensure' => 'file', - 'content' => "LoadModule mpm_itk_module /usr/lib/apache2/modules/mod_mpm_itk.so\n") + expect(subject).to contain_file('/etc/apache2/mods-available/mpm_itk.load').with('ensure' => 'file', + 'content' => loadcontent) } - it { is_expected.to contain_file('/etc/apache2/mods-enabled/itk.load').with_ensure('link') } + it { is_expected.to contain_file('/etc/apache2/mods-enabled/mpm_itk.load').with_ensure('link') } end context 'with enablecapabilities not set' do @@ -33,7 +37,7 @@ 'class { "apache": mpm_module => prefork, }' end - it { is_expected.not_to contain_file('/etc/apache2/mods-available/itk.conf').with_content(%r{EnableCapabilities}) } + it { is_expected.not_to contain_file('/etc/apache2/mods-available/mpm_itk.conf').with_content(%r{EnableCapabilities}) } end end diff --git a/spec/classes/mod/prefork_spec.rb b/spec/classes/mod/prefork_spec.rb index 0ebe44794a..ade98373be 100644 --- a/spec/classes/mod/prefork_spec.rb +++ b/spec/classes/mod/prefork_spec.rb @@ -9,18 +9,22 @@ context 'on a Debian OS' do include_examples 'Debian 11' + let(:loadcontent) do + "# Conflicts: mpm_event mpm_worker\n"\ + "LoadModule mpm_prefork_module /usr/lib/apache2/modules/mod_mpm_prefork.so\n" + end it { is_expected.to contain_class('apache::params') } it { is_expected.not_to contain_apache__mod('prefork') } - it { is_expected.to contain_file('/etc/apache2/mods-available/prefork.conf').with_ensure('file') } - it { is_expected.to contain_file('/etc/apache2/mods-enabled/prefork.conf').with_ensure('link') } + it { is_expected.to contain_file('/etc/apache2/mods-available/mpm_prefork.conf').with_ensure('file') } + it { is_expected.to contain_file('/etc/apache2/mods-enabled/mpm_prefork.conf').with_ensure('link') } it { - expect(subject).to contain_file('/etc/apache2/mods-available/prefork.load').with('ensure' => 'file', - 'content' => "LoadModule mpm_prefork_module /usr/lib/apache2/modules/mod_mpm_prefork.so\n") + expect(subject).to contain_file('/etc/apache2/mods-available/mpm_prefork.load').with('ensure' => 'file', + 'content' => loadcontent) } - it { is_expected.to contain_file('/etc/apache2/mods-enabled/prefork.load').with_ensure('link') } + it { is_expected.to contain_file('/etc/apache2/mods-enabled/mpm_prefork.load').with_ensure('link') } end context 'on a RedHat OS' do diff --git a/spec/classes/mod/worker_spec.rb b/spec/classes/mod/worker_spec.rb index 3377c9fd2f..c81499e26b 100644 --- a/spec/classes/mod/worker_spec.rb +++ b/spec/classes/mod/worker_spec.rb @@ -9,14 +9,18 @@ context 'on a Debian OS' do include_examples 'Debian 11' + let(:loadcontent) do + "# Conflicts: mpm_event mpm_prefork\n"\ + "LoadModule mpm_worker_module /usr/lib/apache2/modules/mod_mpm_worker.so\n" + end it { is_expected.to contain_class('apache::params') } it { is_expected.not_to contain_apache__mod('worker') } - it { is_expected.to contain_file('/etc/apache2/mods-available/worker.conf').with_ensure('file') } + it { is_expected.to contain_file('/etc/apache2/mods-available/mpm_worker.conf').with_ensure('file') } it { - expect(subject).to contain_file('/etc/apache2/mods-available/worker.load').with('ensure' => 'file', - 'content' => "LoadModule mpm_worker_module /usr/lib/apache2/modules/mod_mpm_worker.so\n") + expect(subject).to contain_file('/etc/apache2/mods-available/mpm_worker.load').with('ensure' => 'file', + 'content' => loadcontent) } end