Skip to content

Commit

Permalink
Merge pull request #1551 from eputnam/MODULES-4048
Browse files Browse the repository at this point in the history
(MODULES-4048) SLES 10 support
  • Loading branch information
hunner committed Nov 9, 2016
2 parents d810408 + bbc35cc commit 05a0aac
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 74 deletions.
32 changes: 23 additions & 9 deletions manifests/params.pp
Expand Up @@ -489,20 +489,34 @@
$lib_path = '/usr/lib64/apache2-prefork'
$suse_lib_path = '/usr/lib64/apache2'
$mpm_module = 'prefork'
$default_ssl_cert = '/etc/ssl/servercerts/servercert.pem'
$default_ssl_key = '/etc/ssl/servercerts/serverkey.pem'
if $::operatingsystemrelease < '11' {
$default_ssl_cert = '/etc/apache2/ssl.crt/snakeoil-rsa.crt'
$default_ssl_key = '/etc/apache2/ssl.key/snakeoil-rsa.key'
} else {
$default_ssl_cert = '/etc/ssl/servercerts/servercert.pem'
$default_ssl_key = '/etc/ssl/servercerts/serverkey.pem'
}
$ssl_certs_dir = '/etc/ssl/certs'
$suphp_addhandler = 'x-httpd-php'
$suphp_engine = 'off'
$suphp_configpath = '/etc/php5/apache2'
$php_version = '5'
$mod_packages = {
'auth_kerb' => 'apache2-mod_auth_kerb',
'perl' => 'apache2-mod_perl',
'php5' => 'apache2-mod_php53',
'python' => 'apache2-mod_python',
'security' => 'apache2-mod_security2',
}
if $::operatingsystemrelease < '11' {
$mod_packages = {
'auth_kerb' => 'apache2-mod_auth_kerb',
'perl' => 'apache2-mod_perl',
'php5' => 'apache2-mod_php5',
'python' => 'apache2-mod_python',
}
} else {
$mod_packages = {
'auth_kerb' => 'apache2-mod_auth_kerb',
'perl' => 'apache2-mod_perl',
'php5' => 'apache2-mod_php53',
'python' => 'apache2-mod_python',
'security' => 'apache2-mod_security2',
}
}
$mod_libs = {
'security' => '/usr/lib64/apache2/mod_security2.so',
'php53' => '/usr/lib64/apache2/mod_php5.so',
Expand Down
2 changes: 1 addition & 1 deletion spec/acceptance/mod_dav_svn_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper_acceptance'
require_relative './version.rb'

describe 'apache::mod::dav_svn class', :unless => (fact('operatingsystem') == 'OracleLinux' and fact('operatingsystemmajrelease') == '7') do
describe 'apache::mod::dav_svn class', :unless => (fact('operatingsystem') == 'OracleLinux' and fact('operatingsystemmajrelease') == '7') || (fact('operatingsystem') == 'SLES' and fact('operatingsystemmajorrelease') < '11') do
case fact('osfamily')
when 'Debian'
if fact('operatingsystemmajrelease') == '6' or fact('operatingsystemmajrelease') == '10.04' or fact('operatingsystemrelease') == '10.04' or fact('operatingsystemmajrelease') == '16.04'
Expand Down
2 changes: 1 addition & 1 deletion spec/acceptance/mod_security_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper_acceptance'
require_relative './version.rb'

describe 'apache::mod::security class', :unless => (fact('osfamily') == 'Debian' and (fact('lsbdistcodename') == 'squeeze' or fact('lsbdistcodename') == 'lucid' or fact('lsbdistcodename') == 'precise' or fact('lsbdistcodename') == 'wheezy')) do
describe 'apache::mod::security class', :unless => (fact('osfamily') == 'Debian' and (fact('lsbdistcodename') == 'squeeze' or fact('lsbdistcodename') == 'lucid' or fact('lsbdistcodename') == 'precise' or fact('lsbdistcodename') == 'wheezy')) || (fact('operatingsystem') == 'SLES' and fact('operatingsystemrelease') < '11') do
context "default mod_security config" do
if fact('osfamily') == 'RedHat' and fact('operatingsystemmajrelease') =~ /(5|6)/
it 'adds epel' do
Expand Down
130 changes: 67 additions & 63 deletions spec/acceptance/vhost_spec.rb
Expand Up @@ -120,31 +120,33 @@ class { 'apache': }
end
end

context 'new proxy vhost on port 80' do
it 'should configure an apache proxy vhost' do
pp = <<-EOS
class { 'apache': }
apache::vhost { 'proxy.example.com':
port => '80',
docroot => '/var/www/proxy',
proxy_pass_match => [
{ 'path' => '/foo', 'url' => 'http://backend-foo/'},
],
proxy_preserve_host => true,
proxy_error_override => true,
}
EOS
apply_manifest(pp, :catch_failures => true)
end
unless (fact('operatingsystem') == 'SLES' and fact('operatingsystemmajorrelease') <= '10')
context 'new proxy vhost on port 80' do
it 'should configure an apache proxy vhost' do
pp = <<-EOS
class { 'apache': }
apache::vhost { 'proxy.example.com':
port => '80',
docroot => '#{$docroot}/proxy',
proxy_pass_match => [
{ 'path' => '/foo', 'url' => 'http://backend-foo/'},
],
proxy_preserve_host => true,
proxy_error_override => true,
}
EOS
apply_manifest(pp, :catch_failures => true)
end

describe file("#{$vhost_dir}/25-proxy.example.com.conf") do
it { is_expected.to contain '<VirtualHost \*:80>' }
it { is_expected.to contain "ServerName proxy.example.com" }
it { is_expected.to contain "ProxyPassMatch /foo http://backend-foo/" }
it { is_expected.to contain "ProxyPreserveHost On" }
it { is_expected.to contain "ProxyErrorOverride On" }
it { is_expected.not_to contain "ProxyAddHeaders" }
it { is_expected.not_to contain "<Proxy \*>" }
describe file("#{$vhost_dir}/25-proxy.example.com.conf") do
it { is_expected.to contain '<VirtualHost \*:80>' }
it { is_expected.to contain "ServerName proxy.example.com" }
it { is_expected.to contain "ProxyPassMatch /foo http://backend-foo/" }
it { is_expected.to contain "ProxyPreserveHost On" }
it { is_expected.to contain "ProxyErrorOverride On" }
it { is_expected.not_to contain "ProxyAddHeaders" }
it { is_expected.not_to contain "<Proxy \*>" }
end
end
end

Expand Down Expand Up @@ -664,47 +666,49 @@ class { 'apache': default_vhost => false, }
end
end

context 'proxy_pass_match for alternative vhost' do
it 'should configure a local vhost and a proxy vhost' do
apply_manifest(%{
class { 'apache': default_vhost => false, }
apache::vhost { 'localhost':
docroot => '/var/www/local',
ip => '127.0.0.1',
port => '8888',
}
apache::listen { '*:80': }
apache::vhost { 'proxy.example.com':
docroot => '/var/www',
port => '80',
add_listen => false,
proxy_pass_match => {
'path' => '/',
'url' => 'http://localhost:8888/subdir/',
},
}
host { 'proxy.example.com': ip => '127.0.0.1', }
file { ['/var/www/local', '/var/www/local/subdir']: ensure => directory, }
file { '/var/www/local/subdir/index.html':
ensure => file,
content => "Hello from localhost\\n",
}
}, :catch_failures => true)
end
unless (fact('operatingsystem') == 'SLES' and fact('operatingsystemmajorrelease') <= '10')
context 'proxy_pass_match for alternative vhost' do
it 'should configure a local vhost and a proxy vhost' do
apply_manifest(%{
class { 'apache': default_vhost => false, }
apache::vhost { 'localhost':
docroot => '/var/www/local',
ip => '127.0.0.1',
port => '8888',
}
apache::listen { '*:80': }
apache::vhost { 'proxy.example.com':
docroot => '/var/www',
port => '80',
add_listen => false,
proxy_pass_match => {
'path' => '/',
'url' => 'http://localhost:8888/subdir/',
},
}
host { 'proxy.example.com': ip => '127.0.0.1', }
file { ['/var/www/local', '/var/www/local/subdir']: ensure => directory, }
file { '/var/www/local/subdir/index.html':
ensure => file,
content => "Hello from localhost\\n",
}
}, :catch_failures => true)
end

describe service($service_name) do
if (fact('operatingsystem') == 'Debian' && fact('operatingsystemmajrelease') == '8')
pending 'Should be enabled - Bug 760616 on Debian 8'
else
it { should be_enabled }
describe service($service_name) do
if (fact('operatingsystem') == 'Debian' && fact('operatingsystemmajrelease') == '8')
pending 'Should be enabled - Bug 760616 on Debian 8'
else
it { should be_enabled }
end
it { is_expected.to be_running }
end
it { is_expected.to be_running }
end

it 'should get a response from the back end' do
shell("/usr/bin/curl --max-redirs 0 proxy.example.com:80") do |r|
expect(r.stdout).to eq("Hello from localhost\n")
expect(r.exit_code).to eq(0)
it 'should get a response from the back end' do
shell("/usr/bin/curl --max-redirs 0 proxy.example.com:80") do |r|
expect(r.stdout).to eq("Hello from localhost\n")
expect(r.exit_code).to eq(0)
end
end
end
end
Expand Down Expand Up @@ -1348,7 +1352,7 @@ class { 'apache::mod::wsgi': }
end
end

context 'on everything but lucid', :unless => (fact('lsbdistcodename') == 'lucid' or (fact('operatingsystem') == 'SLES' && fact('operatingsystemmajrelease') < '12')) do
context 'on everything but lucid', :unless => (fact('lsbdistcodename') == 'lucid' or fact('operatingsystem') == 'SLES') do
it 'import_script applies cleanly' do
pp = <<-EOS
class { 'apache': }
Expand Down

0 comments on commit 05a0aac

Please sign in to comment.