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.
Merge pull request #704 from JCotton1123/fastcgi-resource
Add fastcgi external server defined type
- Loading branch information
Showing
4 changed files
with
167 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
define apache::fastcgi::server ( | ||
$host = '127.0.0.1:9000', | ||
$timeout = 15, | ||
$flush = false, | ||
$faux_path = "/var/www/$name.fcgi", | ||
$alias = "/$name.fcgi", | ||
$file_type = 'application/x-httpd-php' | ||
) { | ||
|
||
Apache::Mod['fastcgi'] -> Apache::Fastcgi::Server["$title"] | ||
|
||
file { "fastcgi-pool-$name.conf": | ||
ensure => present, | ||
path => "${::apache::confd_dir}/fastcgi-pool-$name.conf", | ||
owner => 'root', | ||
group => $::apache::params::root_group, | ||
mode => '0644', | ||
content => template('apache/fastcgi/server.erb'), | ||
require => Exec["mkdir ${::apache::confd_dir}"], | ||
before => File[$::apache::confd_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,90 @@ | ||
require 'spec_helper' | ||
|
||
describe 'apache::fastcgi::server', :type => :define do | ||
let :pre_condition do | ||
'include apache' | ||
end | ||
let :title do | ||
'www' | ||
end | ||
describe 'os-dependent items' do | ||
context "on RedHat based systems" do | ||
let :default_facts do | ||
{ | ||
:osfamily => 'RedHat', | ||
:operatingsystemrelease => '6', | ||
:concat_basedir => '/dne', | ||
} | ||
end | ||
let :facts do default_facts end | ||
it { should contain_class("apache") } | ||
it { should contain_class("apache::mod::fastcgi") } | ||
it { should contain_file("fastcgi-pool-#{title}.conf").with( | ||
:ensure => 'present', | ||
:path => "/etc/httpd/conf.d/fastcgi-pool-#{title}.conf" | ||
) } | ||
end | ||
context "on Debian based systems" do | ||
let :default_facts do | ||
{ | ||
:osfamily => 'Debian', | ||
:operatingsystemrelease => '6', | ||
:concat_basedir => '/dne', | ||
} | ||
end | ||
let :facts do default_facts end | ||
it { should contain_class("apache") } | ||
it { should contain_class("apache::mod::fastcgi") } | ||
it { should contain_file("fastcgi-pool-#{title}.conf").with( | ||
:ensure => 'present', | ||
:path => "/etc/apache2/conf.d/fastcgi-pool-#{title}.conf" | ||
) } | ||
end | ||
context "on FreeBSD systems" do | ||
let :default_facts do | ||
{ | ||
:osfamily => 'FreeBSD', | ||
:operatingsystemrelease => '9', | ||
:concat_basedir => '/dne', | ||
} | ||
end | ||
let :facts do default_facts end | ||
it { should contain_class("apache") } | ||
it { should contain_class("apache::mod::fastcgi") } | ||
it { should contain_file("fastcgi-pool-#{title}.conf").with( | ||
:ensure => 'present', | ||
:path => "/usr/local/etc/apache22/Includes/fastcgi-pool-#{title}.conf" | ||
) } | ||
end | ||
end | ||
describe 'os-independent items' do | ||
let :facts do | ||
{ | ||
:osfamily => 'Debian', | ||
:operatingsystemrelease => '6', | ||
:concat_basedir => '/dne', | ||
} | ||
end | ||
describe ".conf content" do | ||
let :params do | ||
{ | ||
:host => '127.0.0.1:9001', | ||
:timeout => 30, | ||
:flush => true, | ||
:faux_path => '/var/www/php-www.fcgi', | ||
:alias => '/php-www.fcgi', | ||
:file_type => 'application/x-httpd-php' | ||
} | ||
end | ||
let :expected do | ||
'FastCGIExternalServer /var/www/php-www.fcgi -idle-timeout 30 -flush -host 127.0.0.1:9001 | ||
Alias /php-www.fcgi /var/www/php-www.fcgi | ||
Action application/x-httpd-php /php-www.fcgi | ||
' | ||
end | ||
it do | ||
should contain_file("fastcgi-pool-www.conf").with_content(expected) | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FastCGIExternalServer <%= @faux_path %> -idle-timeout <%= @timeout %> <%= if @flush then '-flush' end %> -host <%= @host %> | ||
Alias <%= @alias %> <%= faux_path %> | ||
Action <%= @file_type %> <%= @alias %> |