Skip to content

Commit

Permalink
Merge pull request #950 from jlambert121/modules_1554
Browse files Browse the repository at this point in the history
MODULES-1554: update error docs and icons path for RHEL7-based systems
  • Loading branch information
igalic committed Jan 15, 2015
2 parents 76fd199 + 7511cda commit d6da29d
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 5 deletions.
3 changes: 0 additions & 3 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -242,21 +242,18 @@
'debian': {
$pidfile = "\${APACHE_PID_FILE}"
$error_log = 'error.log'
$error_documents_path = '/usr/share/apache2/error'
$scriptalias = '/usr/lib/cgi-bin'
$access_log_file = 'access.log'
}
'redhat': {
$pidfile = 'run/httpd.pid'
$error_log = 'error_log'
$error_documents_path = '/var/www/error'
$scriptalias = '/var/www/cgi-bin'
$access_log_file = 'access_log'
}
'freebsd': {
$pidfile = '/var/run/httpd.pid'
$error_log = 'httpd-error.log'
$error_documents_path = '/usr/local/www/apache22/error'
$scriptalias = '/usr/local/www/apache22/cgi-bin'
$access_log_file = 'httpd-access.log'
}
Expand Down
7 changes: 6 additions & 1 deletion manifests/mod/alias.pp
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
class apache::mod::alias(
$apache_version = $apache::apache_version
) {
$ver24 = versioncmp($apache_version, 2.4) >= 0

$icons_path = $::osfamily ? {
'debian' => '/usr/share/apache2/icons',
'redhat' => '/var/www/icons',
'redhat' => $ver24 ? {
true => '/usr/share/httpd/icons',
default => '/var/www/icons',
},
'freebsd' => '/usr/local/www/apache22/icons',
}
apache::mod { 'alias': }
Expand Down
8 changes: 7 additions & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,11 @@
$mime_support_package = 'mailcap'
$mime_types_config = '/etc/mime.types'
$docroot = '/var/www/html'
if $::osfamily == 'RedHat' {
$error_documents_path = $::apache::version::distrelease ? {
'7' => '/usr/share/httpd/error',
default => '/var/www/error'
}
if $::osfamily == "RedHat" {
$wsgi_socket_prefix = '/var/run/wsgi'
} else {
$wsgi_socket_prefix = undef
Expand Down Expand Up @@ -219,6 +223,7 @@
'base_rules/modsecurity_crs_59_outbound_blocking.conf',
'base_rules/modsecurity_crs_60_correlation.conf'
]
$error_documents_path = '/usr/share/apache2/error'

#
# Passenger-specific settings
Expand Down Expand Up @@ -335,6 +340,7 @@
$mime_types_config = '/usr/local/etc/mime.types'
$wsgi_socket_prefix = undef
$docroot = '/usr/local/www/apache22/data'
$error_documents_path = '/usr/local/www/apache22/error'
} else {
fail("Class['apache::params']: Unsupported osfamily: ${::osfamily}")
}
Expand Down
68 changes: 68 additions & 0 deletions spec/classes/mod/alias_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
require 'spec_helper'

describe 'apache::mod::alias', :type => :class do
let :pre_condition do
'include apache'
end
context "on a Debian OS", :compile do
let :facts do
{
:id => 'root',
:kernel => 'Linux',
:lsbdistcodename => 'squeeze',
:osfamily => 'Debian',
:operatingsystem => 'Debian',
:operatingsystemrelease => '6',
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
:concat_basedir => '/dne',
}
end
it { is_expected.to contain_apache__mod("alias") }
it { is_expected.to contain_file("alias.conf").with(:content => /Alias \/icons\/ "\/usr\/share\/apache2\/icons\/"/) }
end
context "on a RedHat 6-based OS", :compile do
let :facts do
{
:id => 'root',
:kernel => 'Linux',
:osfamily => 'RedHat',
:operatingsystem => 'RedHat',
:operatingsystemrelease => '6',
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
:concat_basedir => '/dne',
}
end
it { is_expected.to contain_apache__mod("alias") }
it { is_expected.to contain_file("alias.conf").with(:content => /Alias \/icons\/ "\/var\/www\/icons\/"/) }
end
context "on a RedHat 7-based OS", :compile do
let :facts do
{
:id => 'root',
:kernel => 'Linux',
:osfamily => 'RedHat',
:operatingsystem => 'RedHat',
:operatingsystemrelease => '7',
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
:concat_basedir => '/dne',
}
end
it { is_expected.to contain_apache__mod("alias") }
it { is_expected.to contain_file("alias.conf").with(:content => /Alias \/icons\/ "\/usr\/share\/httpd\/icons\/"/) }
end
context "on a FreeBSD OS", :compile do
let :facts do
{
:id => 'root',
:kernel => 'FreeBSD',
:osfamily => 'FreeBSD',
:operatingsystem => 'FreeBSD',
:operatingsystemrelease => '9',
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
:concat_basedir => '/dne',
}
end
it { is_expected.to contain_apache__mod("alias") }
it { is_expected.to contain_file("alias.conf").with(:content => /Alias \/icons\/ "\/usr\/local\/www\/apache22\/icons\/"/) }
end
end

0 comments on commit d6da29d

Please sign in to comment.