]> gitweb.fluxo.info Git - leap/leap_cli.git/commitdiff
add support to haproxy_servers macro for the possibility that at node might haproxy...
authorelijah <elijah@riseup.net>
Fri, 20 Sep 2013 19:18:27 +0000 (12:18 -0700)
committerelijah <elijah@riseup.net>
Fri, 20 Sep 2013 19:18:27 +0000 (12:18 -0700)
lib/leap_cli/config/macros.rb
lib/leap_cli/version.rb

index 432e66d8776b71b6f38eeba9b65719d0971da0e9..8cc72f42b6c8005f6732527a01563c680e43be78 100644 (file)
@@ -256,12 +256,14 @@ module LeapCli; module Config
     #
     # creates a hash suitable for configuring haproxy. the key is the node name of the server we are proxying to.
     #
-    # stunnel_client contains the mappings to local ports for each node.
+    # * node_list - a hash of nodes for the haproxy servers
+    # * stunnel_client - contains the mappings to local ports for each server node.
+    # * non_stunnel_port - in case self is included in node_list, the port to connect to.
     #
     # 1000 weight is used for nodes in the same location.
     # 100 otherwise.
     #
-    def haproxy_servers(node_list, stunnel_clients)
+    def haproxy_servers(node_list, stunnel_clients, non_stunnel_port=nil)
       default_weight = 10
       local_weight = 100
 
@@ -275,6 +277,12 @@ module LeapCli; module Config
         hsh
       end
 
+      # if one the nodes in the node list is ourself, then there will not be a stunnel to it,
+      # but we need to include it anyway in the haproxy config.
+      if node_list[self.name] && non_stunnel_port
+        accept_ports[self.name] = non_stunnel_port
+      end
+
       # create the first pass of the servers hash
       servers = node_list.values.inject(Config::ObjectList.new) do |hsh, node|
         weight = default_weight
index 5e2b139b66221d71dd16a2e826670f90aad27e0f..e649d950bac2fbf71065e0fa1498812926c1a997 100644 (file)
@@ -1,6 +1,6 @@
 module LeapCli
   unless defined?(LeapCli::VERSION)
-    VERSION = '1.2.2'
+    VERSION = '1.2.3'
     COMPATIBLE_PLATFORM_VERSION = '0.2.4'..'1.99'
     SUMMARY = 'Command line interface to the LEAP platform'
     DESCRIPTION = 'The command "leap" can be used to manage a bevy of servers running the LEAP platform from the comfort of your own home.'