Merge pull request #584 from brunoleon/maintenance

feat (maintenance): allow to specify maintenance behavior. Add docs.
This commit is contained in:
James Fryman 2015-03-26 07:06:29 -05:00
commit 2354132aa9
3 changed files with 6 additions and 2 deletions

View file

@ -137,6 +137,9 @@
# [*owner*] - Defines owner of the .conf file
# [*group*] - Defines group of the .conf file
# [*mode*] - Defines mode of the .conf file
# [*maintenance*] - A boolean value to set a vhost in maintenance
# [*maintenance_value*] - Value to return when maintenance is on.
# Default to return 503
# Actions:
#
# Requires:
@ -235,6 +238,7 @@ define nginx::resource::vhost (
$group = $::nginx::config::global_group,
$mode = $::nginx::config::global_mode,
$maintenance = false,
$maintenance_value = 'return 503'
) {
validate_re($ensure, '^(present|absent)$',

View file

@ -108,7 +108,7 @@ server {
set $maintenance "off";
<% end -%>
if ($maintenance = "on") {
return 503;
<%= @maintenance_value %>;
}
<% if @rewrite_to_https -%>
if ($ssl_protocol = "") {

View file

@ -82,7 +82,7 @@ server {
set $maintenance "off";
<% end -%>
if ($maintenance = "on") {
return 503;
<%= @maintenance_value %>;
}
<% if Array(@resolver).count > 0 -%>
resolver <% Array(@resolver).each do |r| %> <%= r %><% end %>;