Skip to content

Commit

Permalink
Merge pull request #821 from smerrill/feature/fix-remaining-rhel6-scl…
Browse files Browse the repository at this point in the history
…-issues

Finish SCL support for RHEL/CentOS 6
  • Loading branch information
Morgan Haskel committed Aug 26, 2014
2 parents 3183890 + bd890c2 commit 7bd92bc
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 5 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,10 @@ You may establish a default vhost in this class, the `vhost` class, or both. You

Configures the behavior of the module templates, package names, and default mods by setting the Apache version. Default is determined by the class `apache::version` using the OS family and release. It should not be configured manually without special reason.

#####`conf_dir`

Changes the location of the configuration directory the main configuration file is placed in. Defaults to '/etc/httpd/conf' on RedHat, '/etc/apache2' on Debian, and '/usr/local/etc/apache22' on FreeBSD.

#####`confd_dir`

Changes the location of the configuration directory your custom configuration files are placed in. Defaults to '/etc/httpd/conf' on RedHat, '/etc/apache2' on Debian, and '/usr/local/etc/apache22' on FreeBSD.
Expand Down
5 changes: 4 additions & 1 deletion manifests/default_mods.pp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
::apache::mod { 'log_config': }
if versioncmp($apache_version, '2.4') >= 0 {
# Lets fork it
::apache::mod { 'systemd': }
# Do not try to load mod_systemd on RHEL/CentOS 6 SCL.
if !($::osfamily == 'redhat' and versioncmp($::operatingsystemrelease, '7.0') == -1) {
::apache::mod { 'systemd': }
}
::apache::mod { 'unixd': }
}
}
Expand Down
5 changes: 3 additions & 2 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
$timeout = '120',
$httpd_dir = $::apache::params::httpd_dir,
$server_root = $::apache::params::server_root,
$conf_dir = $::apache::params::conf_dir,
$confd_dir = $::apache::params::confd_dir,
$vhost_dir = $::apache::params::vhost_dir,
$vhost_enable_dir = $::apache::params::vhost_enable_dir,
Expand Down Expand Up @@ -219,7 +220,7 @@
content => template('apache/ports_header.erb')
}

if $::apache::params::conf_dir and $::apache::params::conf_file {
if $::apache::conf_dir and $::apache::params::conf_file {
case $::osfamily {
'debian': {
$docroot = '/var/www'
Expand Down Expand Up @@ -276,7 +277,7 @@
# - $server_tokens
# - $server_signature
# - $trace_enable
file { "${::apache::params::conf_dir}/${::apache::params::conf_file}":
file { "${::apache::conf_dir}/${::apache::params::conf_file}":
ensure => file,
content => template($conf_template),
notify => Class['Apache::Service'],
Expand Down
2 changes: 1 addition & 1 deletion manifests/mod.pp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
$package_before = $::osfamily ? {
'freebsd' => [
File[$_loadfile_name],
File["${::apache::params::conf_dir}/${::apache::params::conf_file}"]
File["${::apache::conf_dir}/${::apache::params::conf_file}"]
],
default => File[$_loadfile_name],
}
Expand Down
2 changes: 1 addition & 1 deletion manifests/mod/mime_magic.pp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class apache::mod::mime_magic (
$magic_file = "${::apache::params::conf_dir}/magic"
$magic_file = "${::apache::conf_dir}/magic"
) {
apache::mod { 'mime_magic': }
# Template uses $magic_file
Expand Down
12 changes: 12 additions & 0 deletions spec/classes/apache_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,18 @@
it { is_expected.to contain_file("/etc/httpd/conf/httpd.conf").with_content %r{^Include "/etc/httpd/mod\.d/\*\.load"$} }
end

describe "Alternate conf directory" do
let :params do
{ :conf_dir => '/opt/rh/root/etc/httpd/conf' }
end

it { is_expected.to contain_file("/opt/rh/root/etc/httpd/conf/httpd.conf").with(
'ensure' => 'file',
'notify' => 'Class[Apache::Service]',
'require' => 'Package[httpd]'
) }
end

describe "Alternate conf.d directory" do
let :params do
{ :confd_dir => '/etc/httpd/special_conf.d' }
Expand Down

0 comments on commit 7bd92bc

Please sign in to comment.