Skip to content

Commit 58682fa

Browse files
committed
Merge pull request #591 from typhonius/mod_actions
Added in mod_actions to the repo so it may be used.
2 parents b499aa2 + 736382c commit 58682fa

9 files changed

Lines changed: 44 additions & 4 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,7 @@ Used to enable arbitrary Apache HTTPD modules for which there is no specific `ap
413413

414414
There are many `apache::mod::[name]` classes within this module that can be declared using `include`:
415415

416+
* `actions`
416417
* `alias`
417418
* `auth_basic`
418419
* `auth_kerb`

manifests/default_mods.pp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@
2121
include ::apache::mod::reqtimeout
2222
}
2323
'redhat': {
24+
include ::apache::mod::actions
2425
include ::apache::mod::cache
2526
include ::apache::mod::mime
2627
include ::apache::mod::mime_magic
2728
include ::apache::mod::vhost_alias
2829
include ::apache::mod::rewrite
29-
::apache::mod { 'actions': }
3030
::apache::mod { 'auth_digest': }
3131
::apache::mod { 'authn_anon': }
3232
::apache::mod { 'authn_dbm': }
@@ -55,6 +55,7 @@
5555
}
5656
}
5757
'freebsd': {
58+
include ::apache::mod::actions
5859
include ::apache::mod::cache
5960
include ::apache::mod::disk_cache
6061
include ::apache::mod::headers
@@ -65,7 +66,6 @@
6566
include ::apache::mod::userdir
6667
include ::apache::mod::vhost_alias
6768

68-
::apache::mod { 'actions': }
6969
::apache::mod { 'asis': }
7070
::apache::mod { 'auth_digest': }
7171
::apache::mod { 'authn_alias': }

manifests/mod/actions.pp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
class apache::mod::actions {
2+
apache::mod { 'actions': }
3+
}

manifests/vhost.pp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@
169169
$wsgi_script_aliases = undef,
170170
$custom_fragment = undef,
171171
$itk = undef,
172+
$action = undef,
172173
$fastcgi_server = undef,
173174
$fastcgi_socket = undef,
174175
$fastcgi_dir = undef,

spec/acceptance/vhost_spec.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -682,6 +682,25 @@ class { 'apache': service_ensure => stopped, }
682682
end
683683
end
684684

685+
describe 'actions' do
686+
it 'applies cleanly' do
687+
pp = <<-EOS
688+
class { 'apache': }
689+
host { 'test.server': ip => '127.0.0.1' }
690+
apache::vhost { 'test.server':
691+
docroot => '/tmp',
692+
action => 'php-fastcgi',
693+
}
694+
EOS
695+
apply_manifest(pp, :catch_failures => true)
696+
end
697+
698+
describe file("#{$vhost_dir}/25-test.server.conf") do
699+
it { should be_file }
700+
it { should contain 'Action php-fastcgi /cgi-bin virtual' }
701+
end
702+
end
703+
685704
describe 'suphp' do
686705
it 'applies cleanly' do
687706
pp = <<-EOS

spec/defines/vhost_spec.rb

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@
269269
:attr => 'scriptalias',
270270
:value => '/usr/scripts',
271271
:match => [
272-
/^ ScriptAlias \/cgi-bin\/ "\/usr\/scripts"$/,
272+
/^ ScriptAlias \/cgi-bin "\/usr\/scripts"$/,
273273
],
274274
},
275275
{
@@ -1179,6 +1179,17 @@
11791179
end
11801180
end
11811181

1182+
describe 'when action is specified specified' do
1183+
let :params do default_params.merge({
1184+
:action => 'php-fastcgi',
1185+
}) end
1186+
it 'should set Action' do
1187+
should contain_file("25-#{title}.conf").with_content(
1188+
/^ Action php-fastcgi \/cgi-bin virtual$/
1189+
)
1190+
end
1191+
end
1192+
11821193
describe 'when suphp_engine is on and suphp_configpath is specified' do
11831194
let :params do default_params.merge({
11841195
:suphp_engine => 'on',

templates/vhost.conf.erb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
<% elsif @access_log -%>
4545
CustomLog "<%= @access_log_destination %>" <%= @_access_log_format %>
4646
<% end -%>
47+
<%= scope.function_template(['apache/vhost/_action.erb']) -%>
4748
<%= scope.function_template(['apache/vhost/_block.erb']) -%>
4849
<%= scope.function_template(['apache/vhost/_error_document.erb']) -%>
4950
<%= scope.function_template(['apache/vhost/_proxy.erb']) -%>

templates/vhost/_action.erb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<% if @action -%>
2+
3+
Action <%= @action %> /cgi-bin virtual
4+
<% end -%>

templates/vhost/_scriptalias.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
## Script alias directives
1111
<%# Combine scriptalais and scriptaliases into a single data structure -%>
1212
<%# for backward compatibility and ease of implementation -%>
13-
<%- aliases << { 'alias' => '/cgi-bin/', 'path' => @scriptalias } if @scriptalias -%>
13+
<%- aliases << { 'alias' => '/cgi-bin', 'path' => @scriptalias } if @scriptalias -%>
1414
<%- aliases.flatten.compact! -%>
1515
<%- aliases.each do |salias| -%>
1616
<%- if salias["path"] != '' -%>

0 commit comments

Comments
 (0)