From 9b55b9a0feac9ec778db74f250d4bc2bb5831e08 Mon Sep 17 00:00:00 2001 From: elijah Date: Sat, 21 Jun 2014 02:52:43 -0700 Subject: haproxy: support read only couchdb mirrors --- provider_base/lib/macros/haproxy.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'provider_base') 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 -- cgit v1.2.3