summaryrefslogtreecommitdiff
path: root/provider_base/lib
diff options
context:
space:
mode:
authorAzul <azul@riseup.net>2014-07-16 10:32:27 +0200
committerAzul <azul@riseup.net>2014-07-16 10:32:27 +0200
commitd341c90c1493a78ed0ee2e216797651ff0aebfa9 (patch)
tree05915d577f219d032119534e20fb8eaf3dc0bf94 /provider_base/lib
parentac5781ef6edaf03f06fa980478726aa7d11653c0 (diff)
haproxy connects to a local couch if available
When running a service that requires couch (webapp or mx) on a node that also had couch running the haproxy was confused because it did not have an stunnel port for the local couch. Emit a more useful error and fixed this for webapp and mx
Diffstat (limited to 'provider_base/lib')
-rw-r--r--provider_base/lib/macros/haproxy.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/provider_base/lib/macros/haproxy.rb b/provider_base/lib/macros/haproxy.rb
index c0f9ede5..602ae726 100644
--- a/provider_base/lib/macros/haproxy.rb
+++ b/provider_base/lib/macros/haproxy.rb
@@ -39,6 +39,10 @@ module LeapCli
# create the first pass of the servers hash
servers = node_list.values.inject(Config::ObjectList.new) do |hsh, node|
+ # make sure we have a port to talk to
+ unless accept_ports[node.name]
+ error "haproxy needs a local port to talk to when connecting to #{node.name}"
+ end
weight = default_weight
try {
weight = local_weight if self.location.name == node.location.name
@@ -46,7 +50,7 @@ module LeapCli
hsh[node.name] = Config::Object[
'backup', false,
'host', 'localhost',
- 'port', accept_ports[node.name] || 0,
+ 'port', accept_ports[node.name],
'weight', weight
]
if node.services.include?('couchdb')
@@ -66,4 +70,4 @@ module LeapCli
end
end
-end \ No newline at end of file
+end