Skip to content

Commit

Permalink
Merge pull request #604 from bodgit/sethandler
Browse files Browse the repository at this point in the history
Add support for SetHandler directive
  • Loading branch information
igalic committed Apr 2, 2014
2 parents edcf4b0 + b05d141 commit 8f0da04
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 0 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
32 changes: 32 additions & 0 deletions spec/acceptance/vhost_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
2 changes: 2 additions & 0 deletions spec/defines/vhost_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,7 @@
'options' => '-MultiViews',
'order' => 'deny,yned',
'passenger_enabled' => 'onf',
'sethandler' => 'None',
},
:match => [
/^ <Directory "\/opt\/app">$/,
Expand All @@ -695,6 +696,7 @@
/^ Deny from google.com$/,
/^ Options -MultiViews$/,
/^ Order deny,yned$/,
/^ SetHandler None$/,
/^ PassengerEnabled onf$/,
/^ <\/Directory>$/,
],
Expand Down
3 changes: 3 additions & 0 deletions templates/vhost/_directories.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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 -%>
Expand Down

0 comments on commit 8f0da04

Please sign in to comment.