summaryrefslogtreecommitdiff
path: root/provider_base
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2014-06-21 02:52:43 -0700
committerelijah <elijah@riseup.net>2014-06-25 18:17:39 -0700
commit26cbd9a70c4b19b591a6f865812f0ad98de2668c (patch)
tree722c9e92cbb3cde72bd131c31e308f2435a89fa6 /provider_base
parent73674f928756321a6b35f06a62a0ff1cf0ff479b (diff)
haproxy: support read only couchdb mirrors
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