Bruno Tavares faf9d932ba Fix proxy and redirect configuration file names.
While working on puppet-lodgeit acceptance tests we found that the
configuration file that `httpd::mod::proxy` creates was not being picked
up by Apache because it was missing the prefix `.conf`. This transition
is required to configure httpd modules correctly on Apache >= 2.4

To prevent Apache from loading two the same configuration twice, we
remove the file without extension, so this change does not affect
running systems.

This change has fixes for `httpd::mod::proxy` and `httpd::mod::redirect`
as they have the same issue. We added tests as well to increase the
confidence on the fix.

The acceptance will be fixed on the follow-up patch, as the redirect
grants are broken for 2.4 as well.

Change-Id: I82241038d687316f91f18209fe8323c12422e2f8
Co-Authored-By: Danilo Ramalho <dramalho@thoughtworks.com>
2015-10-19 15:43:51 -02:00

58 lines
1.1 KiB
Puppet

# Define: httpd::vhost::redirect
#
# This class will create a vhost that does nothing more than redirect to a
# given location
#
# Parameters:
# $port:
# Which port to list on
# $dest:
# Where to redirect to
# - $vhost_name
#
# Actions:
# Installs apache and creates a vhost
#
# Requires:
#
# Sample Usage:
#
define httpd::vhost::redirect (
$port,
$dest,
$priority = '10',
$serveraliases = undef,
$template = 'httpd/vhost-redirect.conf.erb',
$vhost_name = '*'
) {
include ::httpd
$srvname = $name
file { "${priority}-${name}":
ensure => absent,
path => "${httpd::params::vdir}/${priority}-${name}",
}
file { "${priority}-${name}.conf":
path => "${httpd::params::vdir}/${priority}-${name}.conf",
content => template($template),
owner => 'root',
group => 'root',
mode => '0755',
require => Package['httpd'],
notify => Service['httpd'],
}
if ! defined(Firewall["0100-INPUT ACCEPT ${port}"]) {
@firewall {
"0100-INPUT ACCEPT ${port}":
jump => 'ACCEPT',
dport => '$port',
proto => 'tcp'
}
}
}