Merge "Fix proxy and redirect configuration file names."

This commit is contained in:
Jenkins 2015-10-20 08:36:32 +00:00 committed by Gerrit Code Review
commit 945f4f3862
4 changed files with 69 additions and 2 deletions

View File

@ -46,7 +46,12 @@ define httpd::vhost::proxy (
}
file { "${priority}-${name}":
path => "${httpd::params::vdir}/${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',

View File

@ -31,7 +31,12 @@ define httpd::vhost::redirect (
$srvname = $name
file { "${priority}-${name}":
path => "${httpd::params::vdir}/${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',

View File

@ -112,5 +112,20 @@ describe 'puppet-httpd module' do
describe command('a2query -m ssl'), :if => ['debian', 'ubuntu'].include?(os[:family]) do
its(:stdout) { should match 'enabled' }
end
describe 'vhosts' do
describe command('curl --verbose http://localhost') do
its(:stdout) { should include 'Index of /' }
end
describe command('curl --verbose -H "Host: proxy" http://localhost/acceptance.txt') do
its(:stdout) { should include 'Acceptance Test' }
end
describe command('curl --verbose -H "Host: redirect" http://localhost') do
its(:stdout) { should include '302' }
its(:stdout) { should include 'http://localhost:8080/acceptance.txt' }
end
end
end
end

View File

@ -10,6 +10,48 @@ httpd::vhost { 'localhost':
redirect_ssl => true,
}
# Enable a secondary port to test proxy and redirect modules
$override = '
Listen 8080
<Directory "/html">
Options All
AllowOverride All
Require all granted
Allow from all
</Directory>
'
file { "${::httpd::params::vdir}override.conf":
content => $override,
}
file { '/html':
ensure => directory,
mode => '0755',
}
file { '/html/acceptance.txt':
ensure => present,
mode => '0644',
content => 'Acceptance Test',
require => File['/html'],
}
httpd::vhost { 'acceptance-server':
servername => 'localhost',
port => 8080,
docroot => '/html',
priority => 50,
}
httpd::mod { 'proxy': ensure => present; }
httpd::mod { 'proxy_http': ensure => present; }
httpd::vhost::proxy { 'proxy':
port => 80,
dest => 'http://localhost:8080',
}
httpd::vhost::redirect { 'redirect':
port => 80,
dest => 'http://localhost:8080/acceptance.txt',
}
httpd::mod { 'rewrite':
ensure => present,
}