Skip to content

Commit

Permalink
Merge pull request #792 from roidelapluie/reqtimeout
Browse files Browse the repository at this point in the history
configure timeouts for apache::mod::reqtimeout
  • Loading branch information
Morgan Haskel committed Aug 7, 2014
2 parents b2b0022 + 990ffef commit 1f8a39b
Show file tree
Hide file tree
Showing 4 changed files with 137 additions and 3 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
* [Class: apache::mod::fcgid](#class-apachemodfcgid)
* [Class: apache::mod::negotiation](#class-apachemodnegotiation)
* [Class: apache::mod::deflate](#class-apachemoddeflate)
* [Class: apache::mod::reqtimeout](#class-apachemodreqtimeout)
* [Defined Type: apache::vhost](#defined-type-apachevhost)
* [Parameter: `directories` for apache::vhost](#parameter-directories-for-apachevhost)
* [SSL parameters for apache::vhost](#ssl-parameters-for-apachevhost)
Expand Down Expand Up @@ -745,6 +746,24 @@ An array of mime types that will be deflated.

A hash where the key represents the type and the value represents the note name.


####Class: `apache::mod::reqtimeout`

Installs and configures mod_reqtimeout. Defaults to recommended apache
mod_reqtimeout configuration.

```puppet
class { '::apache::mod::reqtimeout':
timeouts => ['header=20-40,MinRate=500', 'body=20,MinRate=500'],
}
```

#####`timeouts`

A string or an array that sets the `RequestReadTimeout` option. Defaults to
`['header=20-40,MinRate=500', 'body=20,MinRate=500']`.


####Defined Type: `apache::vhost`

The Apache module allows a lot of flexibility in the setup and configuration of virtual hosts. This flexibility is due, in part, to `vhost`'s being a defined resource type, which allows it to be evaluated multiple times with different parameters.
Expand Down
4 changes: 3 additions & 1 deletion manifests/mod/reqtimeout.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
class apache::mod::reqtimeout {
class apache::mod::reqtimeout (
$timeouts = ['header=20-40,minrate=500', 'body=10,minrate=500']
){
::apache::mod { 'reqtimeout': }
# Template uses no variables
file { 'reqtimeout.conf':
Expand Down
112 changes: 112 additions & 0 deletions spec/classes/mod/reqtimeout_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
require 'spec_helper'

describe 'apache::mod::reqtimeout', :type => :class do
let :pre_condition do
'class { "apache":
default_mods => false,
}'
end
context "on a Debian OS" do
let :facts do
{
:osfamily => 'Debian',
:operatingsystemrelease => '6',
:concat_basedir => '/dne',
:operatingsystem => 'Debian',
:id => 'root',
:kernel => 'Linux',
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
:lsbdistcodename => 'squeeze',
}
end
context "passing no parameters" do
it { is_expected.to contain_class("apache::params") }
it { is_expected.to contain_apache__mod('reqtimeout') }
it { is_expected.to contain_file('reqtimeout.conf').with_content(/^RequestReadTimeout header=20-40,minrate=500\nRequestReadTimeout body=10,minrate=500$/) }
end
context "passing timeouts => ['header=20-60,minrate=600', 'body=60,minrate=600']" do
let :params do
{:timeouts => ['header=20-60,minrate=600', 'body=60,minrate=600']}
end
it { is_expected.to contain_class("apache::params") }
it { is_expected.to contain_apache__mod('reqtimeout') }
it { is_expected.to contain_file('reqtimeout.conf').with_content(/^RequestReadTimeout header=20-60,minrate=600\nRequestReadTimeout body=60,minrate=600$/) }
end
context "passing timeouts => 'header=20-60,minrate=600'" do
let :params do
{:timeouts => 'header=20-60,minrate=600'}
end
it { is_expected.to contain_class("apache::params") }
it { is_expected.to contain_apache__mod('reqtimeout') }
it { is_expected.to contain_file('reqtimeout.conf').with_content(/^RequestReadTimeout header=20-60,minrate=600$/) }
end
end
context "on a RedHat OS" do
let :facts do
{
:osfamily => 'RedHat',
:operatingsystemrelease => '6',
:concat_basedir => '/dne',
:operatingsystem => 'Redhat',
:id => 'root',
:kernel => 'Linux',
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
}
end
context "passing no parameters" do
it { is_expected.to contain_class("apache::params") }
it { is_expected.to contain_apache__mod('reqtimeout') }
it { is_expected.to contain_file('reqtimeout.conf').with_content(/^RequestReadTimeout header=20-40,minrate=500\nRequestReadTimeout body=10,minrate=500$/) }
end
context "passing timeouts => ['header=20-60,minrate=600', 'body=60,minrate=600']" do
let :params do
{:timeouts => ['header=20-60,minrate=600', 'body=60,minrate=600']}
end
it { is_expected.to contain_class("apache::params") }
it { is_expected.to contain_apache__mod('reqtimeout') }
it { is_expected.to contain_file('reqtimeout.conf').with_content(/^RequestReadTimeout header=20-60,minrate=600\nRequestReadTimeout body=60,minrate=600$/) }
end
context "passing timeouts => 'header=20-60,minrate=600'" do
let :params do
{:timeouts => 'header=20-60,minrate=600'}
end
it { is_expected.to contain_class("apache::params") }
it { is_expected.to contain_apache__mod('reqtimeout') }
it { is_expected.to contain_file('reqtimeout.conf').with_content(/^RequestReadTimeout header=20-60,minrate=600$/) }
end
end
context "on a FreeBSD OS" do
let :facts do
{
:osfamily => 'FreeBSD',
:operatingsystemrelease => '9',
:concat_basedir => '/dne',
:operatingsystem => 'FreeBSD',
:id => 'root',
:kernel => 'FreeBSD',
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
}
end
context "passing no parameters" do
it { is_expected.to contain_class("apache::params") }
it { is_expected.to contain_apache__mod('reqtimeout') }
it { is_expected.to contain_file('reqtimeout.conf').with_content(/^RequestReadTimeout header=20-40,minrate=500\nRequestReadTimeout body=10,minrate=500$/) }
end
context "passing timeouts => ['header=20-60,minrate=600', 'body=60,minrate=600']" do
let :params do
{:timeouts => ['header=20-60,minrate=600', 'body=60,minrate=600']}
end
it { is_expected.to contain_class("apache::params") }
it { is_expected.to contain_apache__mod('reqtimeout') }
it { is_expected.to contain_file('reqtimeout.conf').with_content(/^RequestReadTimeout header=20-60,minrate=600\nRequestReadTimeout body=60,minrate=600$/) }
end
context "passing timeouts => 'header=20-60,minrate=600'" do
let :params do
{:timeouts => 'header=20-60,minrate=600'}
end
it { is_expected.to contain_class("apache::params") }
it { is_expected.to contain_apache__mod('reqtimeout') }
it { is_expected.to contain_file('reqtimeout.conf').with_content(/^RequestReadTimeout header=20-60,minrate=600$/) }
end
end
end
5 changes: 3 additions & 2 deletions templates/mod/reqtimeout.conf.erb
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
RequestReadTimeout header=20-40,minrate=500
RequestReadTimeout body=10,minrate=500
<% Array(@timeouts).each do |timeout| -%>
RequestReadTimeout <%= timeout %>
<%- end -%>

0 comments on commit 1f8a39b

Please sign in to comment.