diff options
author | elijah <elijah@riseup.net> | 2014-06-21 02:52:43 -0700 |
---|---|---|
committer | elijah <elijah@riseup.net> | 2014-06-21 02:52:43 -0700 |
commit | 9b55b9a0feac9ec778db74f250d4bc2bb5831e08 (patch) | |
tree | e77adcac95d8b3d8fd5ea5f3bbe8f6cab79074c8 /provider_base/lib/macros/haproxy.rb | |
parent | 56917469bd20293dda7e4187c01d822d42ee98cd (diff) |
haproxy: support read only couchdb mirrors
Diffstat (limited to 'provider_base/lib/macros/haproxy.rb')
-rw-r--r-- | provider_base/lib/macros/haproxy.rb | 11 |
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 |