Skip to content

Commit

Permalink
Merge pull request #432 from jlambert121/issue_428
Browse files Browse the repository at this point in the history
allow allow_from to be set for mod_status
  • Loading branch information
igalic committed Nov 5, 2013
2 parents 121958b + f327c63 commit 3374307
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 2 deletions.
4 changes: 3 additions & 1 deletion manifests/mod/status.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
class apache::mod::status {
class apache::mod::status (
$allow_from = ['127.0.0.1','::1'],
){
apache::mod { 'status': }
# Template uses no variables
file { 'status.conf':
Expand Down
40 changes: 40 additions & 0 deletions spec/classes/mod/status_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
require 'spec_helper'

describe 'apache::mod::status', :type => :class do
let :pre_condition do
'include apache'
end

let :facts do
{
:osfamily => 'RedHat',
:operatingsystemrelease => '6',
:concat_basedir => '/dne',
}
end

it { should contain_apache__mod('status') }

context 'default' do
it { should contain_file('status.conf').with_content(/Allow from 127\.0\.0\.1 ::1/) }
end

context 'custom allow_from (string)' do
let :params do
{
:allow_from => '1.2.3.4'
}
end
it { should contain_file('status.conf').with_content(/Allow from 1\.2\.3\.4/) }
end

context 'custom allow_from (array)' do
let :params do
{
:allow_from => [ '1.2.3.4', '2.3.4.5' ]
}
end
it { should contain_file('status.conf').with_content(/Allow from 1\.2\.3\.4 2\.3\.4\.5/) }
end

end
2 changes: 1 addition & 1 deletion templates/mod/status.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
SetHandler server-status
Order deny,allow
Deny from all
Allow from 127.0.0.1 ::1
Allow from <%= Array(@allow_from).join(" ") %>
</Location>
ExtendedStatus On

Expand Down

0 comments on commit 3374307

Please sign in to comment.