forked from redhat-openstack/openstack-puppet-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This adds fcgid.conf to configure the fcgid module. It also adds the FcgidWrapper option to vhost's directories. The vhost option lacks any validation and allows users to shoot themselves in the foot, but without iteration from the puppet future parser I don't see a way to add the validation. Iteration would also allow auto including apache::mod::fcgid.
- Loading branch information
Showing
7 changed files
with
192 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,16 @@ | ||
class apache::mod::fcgid { | ||
class apache::mod::fcgid( | ||
$options = {}, | ||
) { | ||
::apache::mod { 'fcgid': } | ||
|
||
# Template uses: | ||
# - $options | ||
file { 'fcgid.conf': | ||
ensure => file, | ||
path => "${::apache::mod_dir}/fcgid.conf", | ||
content => template('apache/mod/fcgid.conf.erb'), | ||
require => Exec["mkdir ${::apache::mod_dir}"], | ||
before => File[$::apache::mod_dir], | ||
notify => Service['httpd'], | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
require 'spec_helper_acceptance' | ||
|
||
describe 'apache::mod::fcgid class', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do | ||
case fact('osfamily') | ||
when 'Debian' | ||
# Not implemented | ||
when 'RedHat' | ||
context "default fcgid config" do | ||
it 'succeeds in puppeting fcgid' do | ||
pp = <<-EOS | ||
class { 'epel': } # mod_fcgid lives in epel | ||
class { 'apache': } | ||
class { 'apache::mod::php': } # For /usr/bin/php-cgi | ||
class { 'apache::mod::fcgid': | ||
options => { | ||
'FcgidIPCDir' => '/var/run/fcgidsock', | ||
}, | ||
} | ||
apache::vhost { 'fcgid.example.com': | ||
port => '80', | ||
docroot => '/var/www/fcgid', | ||
directories => { | ||
path => '/var/www/fcgid', | ||
options => '+ExecCGI', | ||
addhandlers => { | ||
handler => 'fcgid-script', | ||
extensions => '.php', | ||
}, | ||
fcgiwrapper => { | ||
command => '/usr/bin/php-cgi', | ||
suffix => '.php', | ||
} | ||
}, | ||
} | ||
file { '/var/www/fcgid/index.php': | ||
ensure => file, | ||
owner => 'root', | ||
group => 'root', | ||
content => "<?php echo 'Hello world'; ?>\\n", | ||
} | ||
EOS | ||
apply_manifest(pp, :catch_failures => true) | ||
end | ||
|
||
describe service('httpd') do | ||
it { should be_enabled } | ||
it { should be_running } | ||
end | ||
|
||
it 'should answer to fcgid.example.com' do | ||
shell("/usr/bin/curl -H 'Host: fcgid.example.com' 127.0.0.1:80") do |r| | ||
r.stdout.should =~ /^Hello world$/ | ||
r.exit_code.should == 0 | ||
end | ||
end | ||
|
||
it 'should run a php-cgi process' do | ||
shell("pgrep -u apache php-cgi", :acceptable_exit_codes => [0]) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<IfModule mod_fcgid.c> | ||
<% @options.sort_by {|key, value| key}.each do |key, value| -%> | ||
<%= key %> <%= value %> | ||
<% end -%> | ||
</IfModule> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters