diff --git a/README.md b/README.md index 53e68e164..9bfc8e751 100644 --- a/README.md +++ b/README.md @@ -1335,6 +1335,21 @@ Sets the order of processing Allow and Deny statements as per [Apache core docum } ``` +######`sethandler` + +Sets a `SetHandler` directive as per the [Apache Core documentation](http://httpd.apache.org/docs/2.2/mod/core.html#sethandler). An example: + +```puppet + apache::vhost { 'sample.example.net': + docroot => '/path/to/directory', + directories => [ + { path => '/path/to/directory', + sethandler => 'None', + } + ], + } +``` + ######`passenger_enabled` Sets the value for the [PassengerEnabled](http://www.modrails.com/documentation/Users%20guide%20Apache.html#PassengerEnabled) directory to 'on' or 'off'. Requires `apache::mod::passenger` to be included. diff --git a/spec/acceptance/vhost_spec.rb b/spec/acceptance/vhost_spec.rb index a2fa41940..01c9dcbb0 100644 --- a/spec/acceptance/vhost_spec.rb +++ b/spec/acceptance/vhost_spec.rb @@ -252,6 +252,38 @@ class { 'apache': } shell("/usr/bin/curl -sSf files.example.net:80/private.html", {:acceptable_exit_codes => 22}).stderr.should match(/curl: \(22\) The requested URL returned error: 403/) end end + + describe 'SetHandler directive' do + it 'should configure a vhost with a SetHandler directive' do + pp = <<-EOS + class { 'apache': } + apache::mod { 'status': } + host { 'files.example.net': ip => '127.0.0.1', } + apache::vhost { 'files.example.net': + docroot => '/var/www/files', + directories => [ + { path => '/var/www/files', }, + { path => '/server-status', provider => 'location', sethandler => 'server-status', }, + ], + } + file { '/var/www/files/index.html': + ensure => file, + content => "Hello World\\n", + } + EOS + apply_manifest(pp, :catch_failures => true) + end + + describe service($service_name) do + it { should be_enabled } + it { should be_running } + end + + it 'should answer to files.example.net' do + shell("/usr/bin/curl -sSf files.example.net:80/index.html").stdout.should eq("Hello World\n") + shell("/usr/bin/curl -sSf files.example.net:80/server-status?auto").stdout.should match(/Scoreboard: /) + end + end end case fact('lsbdistcodename') diff --git a/spec/defines/vhost_spec.rb b/spec/defines/vhost_spec.rb index b16ce8840..234fdbd0b 100644 --- a/spec/defines/vhost_spec.rb +++ b/spec/defines/vhost_spec.rb @@ -686,6 +686,7 @@ 'options' => '-MultiViews', 'order' => 'deny,yned', 'passenger_enabled' => 'onf', + 'sethandler' => 'None', }, :match => [ /^ $/, @@ -695,6 +696,7 @@ /^ Deny from google.com$/, /^ Options -MultiViews$/, /^ Order deny,yned$/, + /^ SetHandler None$/, /^ PassengerEnabled onf$/, /^ <\/Directory>$/, ], diff --git a/templates/vhost/_directories.erb b/templates/vhost/_directories.erb index 516d0798d..efa26ce4e 100644 --- a/templates/vhost/_directories.erb +++ b/templates/vhost/_directories.erb @@ -63,6 +63,9 @@ AddHandler <%= addhandler['handler'] %> <%= Array(addhandler['extensions']).join(' ') %> <%- end -%> <%- end -%> + <%- if directory['sethandler'] and directory['sethandler'] != '' -%> + SetHandler <%= directory['sethandler'] %> + <%- end -%> <%- if directory['passenger_enabled'] and directory['passenger_enabled'] != '' -%> PassengerEnabled <%= directory['passenger_enabled'] %> <%- end -%>