summaryrefslogtreecommitdiff
path: root/provider_base
diff options
context:
space:
mode:
Diffstat (limited to 'provider_base')
-rw-r--r--provider_base/lib/macros/haproxy.rb11
1 files changed, 6 insertions, 5 deletions
diff --git a/provider_base/lib/macros/haproxy.rb b/provider_base/lib/macros/haproxy.rb
index db0d4db8..c0f9ede5 100644
--- a/provider_base/lib/macros/haproxy.rb
+++ b/provider_base/lib/macros/haproxy.rb
@@ -40,17 +40,18 @@ module LeapCli
# create the first pass of the servers hash
servers = node_list.values.inject(Config::ObjectList.new) do |hsh, node|
weight = default_weight
- if self['location'] && node['location']
- if self.location['name'] == node.location['name']
- weight = local_weight
- end
- end
+ try {
+ weight = local_weight if self.location.name == node.location.name
+ }
hsh[node.name] = Config::Object[
'backup', false,
'host', 'localhost',
'port', accept_ports[node.name] || 0,
'weight', weight
]
+ if node.services.include?('couchdb')
+ hsh[node.name]['writable'] = node.couch.mode != 'mirror'
+ end
hsh
end