Skip to content

Commit

Permalink
haproxy: Remove unnecessary checks
Browse files Browse the repository at this point in the history
  • Loading branch information
matrixik committed Apr 10, 2017
1 parent 46dde2e commit 9b14da3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
6 changes: 3 additions & 3 deletions chef/cookbooks/haproxy/providers/loadbalancer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@
section["options"] = [["tcpka", "httplog", "forwardfor"], section["options"]].flatten
end
end
section["acls"] = new_resource.acls || []
section["use_backends"] = new_resource.use_backends || []
section["acls"] = new_resource.acls
section["use_backends"] = new_resource.use_backends
unless new_resource.default_backend.empty?
section["default_backend"] = new_resource.default_backend
end
section["servers"] = new_resource.servers unless new_resource.servers.empty?
section["servers"] = new_resource.servers

node["haproxy"]["sections"][new_resource.type] ||= {}
node["haproxy"]["sections"][new_resource.type][new_resource.name] = section
Expand Down
10 changes: 3 additions & 7 deletions chef/cookbooks/haproxy/templates/default/haproxy.cfg.erb
Original file line number Diff line number Diff line change
Expand Up @@ -60,22 +60,18 @@ listen admin-stats <%= node[:haproxy][:stats][:enabled] ? node[:haproxy][:stats
<% content[:acls].each do |acl| -%>
acl <%= acl %>
<% end -%>
<% content[:use_backends].each do |use_backend| -%>
use_backend <%= use_backend %>
<% end -%>
<% unless content[:default_backend].nil? -%>
default_backend <%= content[:default_backend] %>
<% end -%>
<% unless content[:servers].nil? -%>
<% content[:servers].each do |server| -%>
<% if content[:use_ssl] -%>
<% content[:servers].each do |server| -%>
<% if content[:use_ssl] -%>
server <%= server[:name] %> <%= server[:address] %>:<%= server[:port] %> check-ssl verify none inter 2000 rise 2 fall 5
<% else -%>
<% else -%>
server <%= server[:name] %> <%= server[:address] %>:<%= server[:port] %> check inter 2000 rise 2 fall 5
<% end -%>
<% end -%>
<% end -%>
Expand Down

0 comments on commit 9b14da3

Please sign in to comment.