Skip to content

Commit

Permalink
Merge pull request voxpupuli#584 from brunoleon/maintenance
Browse files Browse the repository at this point in the history
feat (maintenance): allow to specify maintenance behavior. Add docs.
  • Loading branch information
jfryman committed Mar 26, 2015
2 parents 740a6fd + 0378c22 commit f2a8075
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions manifests/resource/vhost.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -235,6 +238,7 @@
$group = $::nginx::config::global_group,
$mode = $::nginx::config::global_mode,
$maintenance = false,
$maintenance_value = 'return 503'
) {

validate_re($ensure, '^(present|absent)$',
Expand Down
2 changes: 1 addition & 1 deletion templates/vhost/vhost_header.erb
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ server {
set $maintenance "off";
<% end -%>
if ($maintenance = "on") {
return 503;
<%= @maintenance_value %>;
}
<% if @rewrite_to_https -%>
if ($ssl_protocol = "") {
Expand Down
2 changes: 1 addition & 1 deletion templates/vhost/vhost_ssl_header.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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 %>;
Expand Down

0 comments on commit f2a8075

Please sign in to comment.