Skip to content

Commit

Permalink
Merge pull request #926 from mhaskel/1.2.x_from_master
Browse files Browse the repository at this point in the history
1.2.x from master
  • Loading branch information
cyberious committed Nov 7, 2014
2 parents 2a68983 + d75e4d3 commit 075f315
Show file tree
Hide file tree
Showing 19 changed files with 234 additions and 111 deletions.
166 changes: 94 additions & 72 deletions README.md

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions manifests/default_mods.pp
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@
include ::apache::mod::cache
include ::apache::mod::mime
include ::apache::mod::mime_magic
include ::apache::mod::vhost_alias
include ::apache::mod::suexec
include ::apache::mod::rewrite
include ::apache::mod::speling
include ::apache::mod::suexec
include ::apache::mod::version
include ::apache::mod::vhost_alias
::apache::mod { 'auth_digest': }
::apache::mod { 'authn_anon': }
::apache::mod { 'authn_dbm': }
Expand All @@ -51,7 +52,6 @@
::apache::mod { 'logio': }
::apache::mod { 'substitute': }
::apache::mod { 'usertrack': }
::apache::mod { 'version': }

if versioncmp($apache_version, '2.4') >= 0 {
::apache::mod { 'authn_core': }
Expand All @@ -71,6 +71,7 @@
include ::apache::mod::reqtimeout
include ::apache::mod::rewrite
include ::apache::mod::userdir
include ::apache::mod::version
include ::apache::mod::vhost_alias
include ::apache::mod::speling

Expand All @@ -93,7 +94,6 @@
::apache::mod { 'logio': }
::apache::mod { 'unique_id': }
::apache::mod { 'usertrack': }
::apache::mod { 'version': }
}
default: {}
}
Expand All @@ -120,7 +120,7 @@
::apache::mod { 'auth_basic': }
::apache::mod { 'authn_file': }

if versioncmp($apache_version, '2.4') >= 0 {
if versioncmp($apache_version, '2.4') >= 0 {
# authz_core is needed for 'Require' directive
::apache::mod { 'authz_core':
id => 'authz_core_module',
Expand Down
4 changes: 1 addition & 3 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
$log_level = $::apache::params::log_level,
$log_formats = {},
$ports_file = $::apache::params::ports_file,
$docroot = $::apache::params::docroot,
$apache_version = $::apache::version::default,
$server_tokens = 'OS',
$server_signature = 'On',
Expand Down Expand Up @@ -239,23 +240,20 @@
if $::apache::conf_dir and $::apache::params::conf_file {
case $::osfamily {
'debian': {
$docroot = '/var/www'
$pidfile = "\${APACHE_PID_FILE}"
$error_log = 'error.log'
$error_documents_path = '/usr/share/apache2/error'
$scriptalias = '/usr/lib/cgi-bin'
$access_log_file = 'access.log'
}
'redhat': {
$docroot = '/var/www/html'
$pidfile = 'run/httpd.pid'
$error_log = 'error_log'
$error_documents_path = '/var/www/error'
$scriptalias = '/var/www/cgi-bin'
$access_log_file = 'access_log'
}
'freebsd': {
$docroot = '/usr/local/www/apache22/data'
$pidfile = '/var/run/httpd.pid'
$error_log = 'httpd-error.log'
$error_documents_path = '/usr/local/www/apache22/error'
Expand Down
10 changes: 4 additions & 6 deletions manifests/mod.pp
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@

# Determine if we have special lib
$mod_libs = $::apache::params::mod_libs
$mod_lib = $mod_libs[$mod] # 2.6 compatibility hack
if $lib {
$_lib = $lib
} elsif $mod_lib {
$_lib = $mod_lib
} elsif has_key($mod_libs, $mod) { # 2.6 compatibility hack
$_lib = $mod_libs[$mod]
} else {
$_lib = "mod_${mod}.so"
}
Expand All @@ -48,11 +47,10 @@

# Determine if we have a package
$mod_packages = $::apache::params::mod_packages
$mod_package = $mod_packages[$mod] # 2.6 compatibility hack
if $package {
$_package = $package
} elsif $mod_package {
$_package = $mod_package
} elsif has_key($mod_packages, $mod) { # 2.6 compatibility hack
$_package = $mod_packages[$mod]
} else {
$_package = undef
}
Expand Down
2 changes: 1 addition & 1 deletion manifests/mod/dav_svn.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
include ::apache::mod::dav
::apache::mod { 'dav_svn': }

if $::osfamily == 'Debian' and ($::operatingsystemmajrelease != '6' and $::operatingsystemmajrelease != '10.04') {
if $::osfamily == 'Debian' and ($::operatingsystemmajrelease != '6' and $::operatingsystemmajrelease != '10.04' and $::operatingsystemrelease != '10.04') {
$loadfile_name = undef
} else {
$loadfile_name = 'dav_svn_authz_svn.load'
Expand Down
1 change: 1 addition & 0 deletions manifests/mod/ssl.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
$ssl_compression = false,
$ssl_options = [ 'StdEnvVars' ],
$ssl_cipher = 'HIGH:MEDIUM:!aNULL:!MD5',
$ssl_protocol = [ 'all', '-SSLv2', '-SSLv3' ],
$apache_version = $::apache::apache_version,
$package_name = undef,
) {
Expand Down
8 changes: 8 additions & 0 deletions manifests/mod/version.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class apache::mod::version {

if ($::osfamily == 'debian' and versioncmp($apache_version, '2.4') >= 0) {
warning("${module_name}: module version_module is built-in and can't be loaded")
} else {
::apache::mod { 'version': }
}
}
3 changes: 3 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
$fastcgi_lib_path = undef
$mime_support_package = 'mailcap'
$mime_types_config = '/etc/mime.types'
$docroot = '/var/www/html'
if $::osfamily == "RedHat" {
$wsgi_socket_prefix = '/var/run/wsgi'
} else {
Expand Down Expand Up @@ -163,6 +164,7 @@
$fastcgi_lib_path = '/var/lib/apache2/fastcgi'
$mime_support_package = 'mime-support'
$mime_types_config = '/etc/mime.types'
$docroot = '/var/www'

#
# Passenger-specific settings
Expand Down Expand Up @@ -273,6 +275,7 @@
$mime_support_package = 'misc/mime-support'
$mime_types_config = '/usr/local/etc/mime.types'
$wsgi_socket_prefix = undef
$docroot = '/usr/local/www/apache22/data'
} else {
fail("Class['apache::params']: Unsupported osfamily: ${::osfamily}")
}
Expand Down
10 changes: 6 additions & 4 deletions manifests/vhost.pp
Original file line number Diff line number Diff line change
Expand Up @@ -795,10 +795,12 @@
# - $passenger_min_instances
# - $passenger_start_timeout
# - $passenger_pre_start
concat::fragment { "${name}-passenger":
target => "${priority_real}-${filename}.conf",
order => 290,
content => template('apache/vhost/_passenger.erb'),
if $passenger_app_root or $passenger_ruby or $passenger_min_instances or $passenger_start_timeout or $passenger_pre_start {
concat::fragment { "${name}-passenger":
target => "${priority_real}-${filename}.conf",
order => 290,
content => template('apache/vhost/_passenger.erb'),
}
}

# Template uses:
Expand Down
12 changes: 3 additions & 9 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"license": "Apache 2.0",
"source": "git://github.com/puppetlabs/puppetlabs-apache.git",
"project_page": "https://github.com/puppetlabs/puppetlabs-apache",
"issues_url": "https://github.com/puppetlabs/puppetlabs-apache/issues",
"issues_url": "https://tickets.puppetlabs.com/browse/MODULES",
"operatingsystem_support": [
{
"operatingsystem": "RedHat",
Expand Down Expand Up @@ -67,13 +67,7 @@
],
"description": "Module for Apache configuration",
"dependencies": [
{
"name": "puppetlabs/stdlib",
"version_requirement": ">= 2.4.0"
},
{
"name": "puppetlabs/concat",
"version_requirement": ">= 1.1.1"
}
{"name":"puppetlabs/stdlib","version_requirement":">= 2.4.0"},
{"name":"puppetlabs/concat","version_requirement":">= 1.1.1"}
]
}
2 changes: 1 addition & 1 deletion spec/acceptance/mod_dav_svn_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
when 'Debian'
mod_dir = '/etc/apache2/mods-available'
service_name = 'apache2'
if fact('operatingsystemmajrelease') == '6' or fact('operatingsystemmajrelease') == '10.04'
if fact('operatingsystemmajrelease') == '6' or fact('operatingsystemmajrelease') == '10.04' or fact('operatingsystemrelease') == '10.04'
authz_svn_load_file = 'dav_svn_authz_svn.load'
else
authz_svn_load_file = 'authz_svn.load'
Expand Down
3 changes: 1 addition & 2 deletions spec/acceptance/vhost_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ class { 'apache': }
end
end

describe 'Satisfy and Auth directive' do
describe 'Satisfy and Auth directive', :unless => $apache_version == '2.4' do
it 'should configure a vhost with Satisfy and Auth directive' do
pp = <<-EOS
class { 'apache': }
Expand Down Expand Up @@ -1082,7 +1082,6 @@ class { 'apache::mod::wsgi': }
wsgi_process_group => 'nobody',
wsgi_script_aliases => { '/test' => '/test1' },
wsgi_pass_authorization => 'On',
wsgi_chunked_request => 'On',
}
EOS
apply_manifest(pp, :catch_failures => true)
Expand Down
14 changes: 13 additions & 1 deletion spec/classes/apache_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
it { is_expected.to contain_user("www-data") }
it { is_expected.to contain_group("www-data") }
it { is_expected.to contain_class("apache::service") }
it { is_expected.to contain_file("/var/www").with(
'ensure' => 'directory'
)
}
it { is_expected.to contain_file("/etc/apache2/sites-enabled").with(
'ensure' => 'directory',
'recurse' => 'true',
Expand Down Expand Up @@ -164,7 +168,7 @@
end

it { is_expected.to contain_file("/etc/apache2/apache2.conf").with_content %r{^LogFormat "%v %h %l %u %t \"%r\" %>s %b" vhost_common\n} }
it { is_expected.to contain_file("/etc/apache2/apache2.conf").with_content %r{^LogFormat "%v %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" vhost_combined\n} }
it { is_expected.to contain_file("/etc/apache2/apache2.conf").with_content %r{^LogFormat "%v %h %l %u %t \"%r\" %>s %b \"%\{Referer\}i\" \"%\{User-agent\}i\"" vhost_combined\n} }
end
end

Expand Down Expand Up @@ -225,6 +229,10 @@
it { is_expected.to contain_user("apache") }
it { is_expected.to contain_group("apache") }
it { is_expected.to contain_class("apache::service") }
it { is_expected.to contain_file("/var/www/html").with(
'ensure' => 'directory'
)
}
it { is_expected.to contain_file("/etc/httpd/conf.d").with(
'ensure' => 'directory',
'recurse' => 'true',
Expand Down Expand Up @@ -498,6 +506,10 @@
it { is_expected.to contain_user("www") }
it { is_expected.to contain_group("www") }
it { is_expected.to contain_class("apache::service") }
it { is_expected.to contain_file("/usr/local/www/apache22/data").with(
'ensure' => 'directory'
)
}
it { is_expected.to contain_file("/usr/local/etc/apache22/Vhosts").with(
'ensure' => 'directory',
'recurse' => 'true',
Expand Down
16 changes: 13 additions & 3 deletions spec/defines/vhost_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,13 @@
'proxy_dest' => '/',
'proxy_pass' => [
{
'path' => '/a',
'url' => 'http://backend-a/'
'path' => '/a',
'url' => 'http://backend-a/',
'keywords' => ['noquery', 'interpolate'],
'params' => {
'retry' => '0',
'timeout' => '5'
}
}
],
'suphp_addhandler' => 'foo',
Expand Down Expand Up @@ -296,7 +301,12 @@
it { is_expected.to contain_concat__fragment('rspec.example.com-action') }
it { is_expected.to contain_concat__fragment('rspec.example.com-block') }
it { is_expected.to contain_concat__fragment('rspec.example.com-error_document') }
it { is_expected.to contain_concat__fragment('rspec.example.com-proxy') }
it { is_expected.to contain_concat__fragment('rspec.example.com-proxy').with_content(
/retry=0/) }
it { is_expected.to contain_concat__fragment('rspec.example.com-proxy').with_content(
/timeout=5/) }
it { is_expected.to contain_concat__fragment('rspec.example.com-proxy').with_content(
/noquery interpolate/) }
it { is_expected.to contain_concat__fragment('rspec.example.com-rack') }
it { is_expected.to contain_concat__fragment('rspec.example.com-redirect') }
it { is_expected.to contain_concat__fragment('rspec.example.com-rewrite') }
Expand Down
6 changes: 5 additions & 1 deletion templates/httpd.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
<% if @log_formats and !@log_formats.empty? -%>
<%- @log_formats.each do |nickname,format| -%>
<%- @log_formats.sort.each do |nickname,format| -%>
LogFormat "<%= format -%>" <%= nickname %>
<%- end -%>
<% end -%>
Expand All @@ -70,7 +70,11 @@ IncludeOptional "<%= @confd_dir %>/*.conf"
Include "<%= @confd_dir %>/*.conf"
<%- end -%>
<% if @vhost_load_dir != @confd_dir -%>
<%- if scope.function_versioncmp([@apache_version, '2.4']) >= 0 -%>
IncludeOptional "<%= @vhost_load_dir %>/*"
<%- else -%>
Include "<%= @vhost_load_dir %>/*"
<%- end -%>
<% end -%>

<% if @error_documents -%>
Expand Down
2 changes: 1 addition & 1 deletion templates/mod/ssl.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
SSLCryptoDevice builtin
SSLHonorCipherOrder On
SSLCipherSuite <%= @ssl_cipher %>
SSLProtocol all -SSLv2 -SSLv3
SSLProtocol <%= @ssl_protocol.compact.join(' ') %>
<% if @ssl_options -%>
SSLOptions <%= @ssl_options.compact.join(' ') %>
<% end -%>
Expand Down
8 changes: 7 additions & 1 deletion templates/vhost/_proxy.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@
ProxyPreserveHost On
<%- end -%>
<%- [@proxy_pass].flatten.compact.each do |proxy| -%>
ProxyPass <%= proxy['path'] %> <%= proxy['url'] %>
ProxyPass <%= proxy['path'] %> <%= proxy['url'] -%>
<%- if proxy['params'] -%>
<%- proxy['params'].each_pair do |key, value| -%> <%= key %>=<%= value -%>
<%- end -%>
<%- end -%>
<%- if proxy['keywords'] %> <%= proxy['keywords'].join(' ') -%>
<%- end %>
<Location <%= proxy['path']%>>
<%- if proxy['reverse_urls'].nil? -%>
ProxyPassReverse <%= proxy['url'] %>
Expand Down
2 changes: 1 addition & 1 deletion templates/vhost/_ssl.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<%- if @ssl_chain -%>
SSLCertificateChainFile "<%= @ssl_chain %>"
<%- end -%>
<%- if @ssl_certs_dir -%>
<%- if @ssl_certs_dir && @ssl_certs_dir != '' -%>
SSLCACertificatePath "<%= @ssl_certs_dir %>"
<%- end -%>
<%- if @ssl_ca -%>
Expand Down
Loading

0 comments on commit 075f315

Please sign in to comment.