Skip to content

Commit

Permalink
Merge pull request #1316 from MiamiOH/master
Browse files Browse the repository at this point in the history
Support itk on redhat
  • Loading branch information
DavidS committed Jan 8, 2016
2 parents 2b43798 + 2e6cd7a commit 8a350af
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 4 deletions.
20 changes: 20 additions & 0 deletions manifests/mod/itk.pp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,26 @@
}

case $::osfamily {
'redhat': {
package { 'httpd-itk':
ensure => present,
}
if versioncmp($apache_version, '2.4') >= 0 {
::apache::mpm{ 'itk':
apache_version => $apache_version,
}
}
else {
file_line { '/etc/sysconfig/httpd itk enable':
ensure => present,
path => '/etc/sysconfig/httpd',
line => 'HTTPD=/usr/sbin/httpd.itk',
match => '#?HTTPD=/usr/sbin/httpd.itk',
require => Package['httpd'],
notify => Class['apache::service'],
}
}
}
'debian', 'freebsd': {
apache::mpm{ 'itk':
apache_version => $apache_version,
Expand Down
10 changes: 9 additions & 1 deletion spec/acceptance/itk_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@
when 'Debian'
service_name = 'apache2'
majrelease = fact('operatingsystemmajrelease')
if [ '6', '7', '10.04', '12.04'].include?(majrelease)
if ['6', '7', '10.04', '12.04'].include?(majrelease)
variant = :itk_only
else
variant = :prefork
end
when 'RedHat'
service_name = 'httpd'
majrelease = fact('operatingsystemmajrelease')
if ['5', '6'].include?(majrelease)
variant = :itk_only
else
variant = :prefork
Expand Down
49 changes: 49 additions & 0 deletions spec/classes/mod/itk_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,55 @@
it { is_expected.to contain_file("/etc/apache2/mods-enabled/itk.load").with_ensure('link') }
end
end
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',
:is_pe => false,
}
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/httpd/conf.d/itk.conf").with_ensure('file') }
it { is_expected.to contain_package("httpd-itk") }

context "with Apache version < 2.4" do
let :params do
{
:apache_version => '2.2',
}
end

it { is_expected.to contain_file_line("/etc/sysconfig/httpd itk enable").with({
'require' => 'Package[httpd]',
})
}
end

context "with Apache version >= 2.4" do
let :pre_condition do
'class { "apache": mpm_module => prefork, }'
end

let :params do
{
:apache_version => '2.4',
}
end

it { is_expected.to contain_file("/etc/httpd/conf.d/itk.load").with({
'ensure' => 'file',
'content' => "LoadModule mpm_itk_module modules/mod_mpm_itk.so\n"
})
}
end
end
context "on a FreeBSD OS" do
let :pre_condition do
'class { "apache": mpm_module => false, }'
Expand Down
10 changes: 7 additions & 3 deletions spec/classes/mod/php_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,13 @@
let :pre_condition do
'class { "apache": mpm_module => itk, }'
end
it 'should raise an error' do
expect { expect(subject).to contain_class("apache::mod::itk") }.to raise_error Puppet::Error, /Unsupported osfamily RedHat/
end
it { is_expected.to contain_class("apache::params") }
it { is_expected.to contain_class("apache::mod::itk") }
it { is_expected.to contain_apache__mod('php5') }
it { is_expected.to contain_package("php") }
it { is_expected.to contain_file("php5.load").with(
:content => "LoadModule php5_module modules/libphp5.so\n"
) }
end
end
describe "on a FreeBSD OS" do
Expand Down

0 comments on commit 8a350af

Please sign in to comment.