Skip to content
Snippets Groups Projects
Commit d056b717 authored by Thomas Bellman's avatar Thomas Bellman
Browse files

Handle EL-7 Include directives in httpd.conf.

The default /etc/httpd/conf/httpd.conf file shipped by EL-6, contains
the line "Include conf.d/*.conf".  In EL-7, that line has been changed
to "IncludeOptional conf.d/*.conf", so it will not throw an error if
there are no files in the conf.d directory.  Change to handle both
variants, and also handle if there should be more than one such line,
or none at all.

The EL-7 httpd.conf file also contains "Include conf.modules.d/*.conf",
as they have moved all the default LoadModule directives to files in
the conf.modules.d directory.  We don't want to disable that, so keep
that line.

The conf.modules.d stuff also affects modules installed as separate
packages, e.g. mod_ssl, mod_wsgi and mod_perl, as the LoadModule
directive those packages provide are now in a separate file in the
conf.modules.d directory, not in the config file in conf.d.  That
only causes a warning about the module being loaded twice, though,
so is not particularly dangerous.
parent 7824709c
No related branches found
No related tags found
No related merge requests found
......@@ -63,11 +63,11 @@ class apache::base
require => Package['httpd'], notify => Class[apache::service];
}
# We do not want to blindly include things in the conf.d directory.
ensure_line {
regexp_replace_lines {
'apache::base::no_include_all':
file => $apache::configfile,
line => '##--Include conf.d/*.conf',
pattern => '^\s*Include\s+conf\.d/\*\.conf\s*$',
pattern => '^\s*Include[A-Za-z]*\s+conf\.d/.*\*.*$',
replacement => '## DISABLED: \&',
require => Package['httpd'],
notify => Class[apache::service];
}
......@@ -177,10 +177,11 @@ define apache::include_file($content=undef, $source=undef, $ensure='present')
"apache::include_file::include::${name}":
file => $apache::configfile,
line => "Include conf.d/${name}.conf",
where => '^##--Include conf\.d/\*\.conf$',
addhow => append,
require => [ Ensure_line['apache::base::no_include_all'],
File[$includefile] ],
require => [
Regexp_replace_lines['apache::base::no_include_all'],
File[$includefile]
],
notify => Class[apache::service];
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment