diff --git a/README.md b/README.md index b98749b58..564e65536 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ * [Class: apache::mod::pagespeed](#class-apachemodpagespeed) * [Class: apache::mod::php](#class-apachemodphp) * [Class: apache::mod::ssl](#class-apachemodssl) + * [Class: apache::mod::status](#class-apachemodstatus) * [Class: apache::mod::wsgi](#class-apachemodwsgi) * [Class: apache::mod::fcgid](#class-apachemodfcgid) * [Class: apache::mod::negotiation](#class-apachemodnegotiation) @@ -556,7 +557,7 @@ There are many `apache::mod::[name]` classes within this module that can be decl * `shib`* (see [`apache::mod::shib`](#class-apachemodshib) below) * `speling` * `ssl`* (see [`apache::mod::ssl`](#class-apachemodssl) below) -* `status`* +* `status`* (see [`apache::mod::status`](#class-apachemodstatus) below) * `suphp` * `userdir`* * `vhost_alias` @@ -721,6 +722,21 @@ Installs Apache SSL capabilities and uses the ssl.conf.erb template. These are t To *use* SSL with a virtual host, you must either set the`default_ssl_vhost` parameter in `::apache` to 'true' or set the `ssl` parameter in `apache::vhost` to 'true'. +####Class: `apache::mod::status` + +Installs Apache mod_status and uses the status.conf.erb template. These are the defaults: + +```puppet + class { 'apache::mod::status': + allow_from = ['127.0.0.1','::1'], + extended_status = 'On', + status_path = '/server-status', +){ + + + } +``` + ####Class: `apache::mod::wsgi` Enables Python support in the WSGI module. To use, simply `include 'apache::mod::wsgi'`. diff --git a/manifests/mod/status.pp b/manifests/mod/status.pp index cfab5d58e..9c6183696 100644 --- a/manifests/mod/status.pp +++ b/manifests/mod/status.pp @@ -9,7 +9,9 @@ # /server-status URL. Defaults to ['127.0.0.1', '::1']. # - $extended_status track and display extended status information. Valid # values are 'On' or 'Off'. Defaults to 'On'. -# +# - $status_path is the path assigned to the Location directive which +# defines the URL to access the server status. Defaults to '/server-status'. +# # Actions: # - Enable and configure Apache mod_status # @@ -27,11 +29,12 @@ $allow_from = ['127.0.0.1','::1'], $extended_status = 'On', $apache_version = $::apache::apache_version, + $status_path = '/server-status', ){ validate_array($allow_from) validate_re(downcase($extended_status), '^(on|off)$', "${extended_status} is not supported for extended_status. Allowed values are 'On' and 'Off'.") ::apache::mod { 'status': } - # Template uses $allow_from, $extended_status, $apache_version + # Template uses $allow_from, $extended_status, $apache_version, $status_path file { 'status.conf': ensure => file, path => "${::apache::mod_dir}/status.conf", diff --git a/spec/classes/mod/status_spec.rb b/spec/classes/mod/status_spec.rb index adb60861b..502562959 100644 --- a/spec/classes/mod/status_spec.rb +++ b/spec/classes/mod/status_spec.rb @@ -1,10 +1,10 @@ require 'spec_helper' # Helper function for testing the contents of `status.conf` -def status_conf_spec(allow_from, extended_status) +def status_conf_spec(allow_from, extended_status, status_path) it do is_expected.to contain_file("status.conf").with_content( - "\n"\ + "\n"\ " SetHandler server-status\n"\ " Order deny,allow\n"\ " Deny from all\n"\ @@ -41,7 +41,7 @@ def status_conf_spec(allow_from, extended_status) it { is_expected.to contain_apache__mod("status") } - status_conf_spec(["127.0.0.1", "::1"], "On") + status_conf_spec(["127.0.0.1", "::1"], "On", "/server-status") it { is_expected.to contain_file("status.conf").with({ :ensure => 'file', @@ -70,13 +70,13 @@ def status_conf_spec(allow_from, extended_status) it { is_expected.to contain_apache__mod("status") } - status_conf_spec(["127.0.0.1", "::1"], "On") + status_conf_spec(["127.0.0.1", "::1"], "On", "/server-status") it { is_expected.to contain_file("status.conf").with_path("/etc/httpd/conf.d/status.conf") } end - context "with custom parameters $allow_from => ['10.10.10.10','11.11.11.11'], $extended_status => 'Off'" do + context "with custom parameters $allow_from => ['10.10.10.10','11.11.11.11'], $extended_status => 'Off', $status_path => '/custom-status'" do let :facts do { :osfamily => 'Debian', @@ -93,10 +93,11 @@ def status_conf_spec(allow_from, extended_status) { :allow_from => ['10.10.10.10','11.11.11.11'], :extended_status => 'Off', + :status_path => '/custom-status', } end - status_conf_spec(["10.10.10.10", "11.11.11.11"], "Off") + status_conf_spec(["10.10.10.10", "11.11.11.11"], "Off", "/custom-status") end diff --git a/templates/mod/status.conf.erb b/templates/mod/status.conf.erb index 84f2e0343..f02ed156f 100644 --- a/templates/mod/status.conf.erb +++ b/templates/mod/status.conf.erb @@ -1,4 +1,4 @@ - +> SetHandler server-status <%- if scope.function_versioncmp([@apache_version, '2.4']) >= 0 -%> Require ip <%= Array(@allow_from).join(" ") %>