Merge pull request #675 from kronostechnologies/refact/upstream

adding a max_fails parameter to upstream member[s]
This commit is contained in:
James Fryman 2015-09-08 10:11:47 -05:00
commit d4d55c309b
3 changed files with 4 additions and 2 deletions

View file

@ -8,6 +8,7 @@
# [*ensure*] - Enables or disables the specified location (present|absent)
# [*upstream_cfg_prepend*] - It expects a hash with custom directives to put before anything else inside upstream
# [*upstream_fail_timeout*] - Set the fail_timeout for the upstream. Default is 10 seconds - As that is what Nginx does normally.
# [*upstream_max_fails*] - Set the max_fails for the upstream. Default is to use nginx default value which is 1.
#
# Actions:
#
@ -43,6 +44,7 @@ define nginx::resource::upstream (
$ensure = 'present',
$upstream_cfg_prepend = undef,
$upstream_fail_timeout = '10s',
$upstream_max_fails = undef,
) {
if $members != undef {

View file

@ -1 +1 @@
server <%= @server %>:<%= @port %> fail_timeout=<%= @upstream_fail_timeout %>;
server <%= @server %>:<%= @port %> fail_timeout=<%= @upstream_fail_timeout %><% if @upstream_max_fails -%> max_fails=<%=@upstream_max_fails %><% end %>;

View file

@ -1,2 +1,2 @@
<% @members.each do |i| %>
server <%= i %> fail_timeout=<%= @upstream_fail_timeout %>;<% end %>
server <%= i %> fail_timeout=<%= @upstream_fail_timeout %><% if @upstream_max_fails -%> max_fails=<%=@upstream_max_fails %><% end %>;<% end %>