Blame rabbitmq-common-0001-Use-proto_dist-from-command-line.patch

5b2912
From: Peter Lemenkov <lemenkov@redhat.com>
5b2912
Date: Fri, 15 Jul 2016 16:01:08 +0200
369b33
Subject: [PATCH] Use proto_dist from command line
369b33
369b33
Use protocol distribution value from command line when provided instead
369b33
of always using default value (inet_tcp) when trying to check epmd.
369b33
369b33
If provided more than one protocol distribution types, then use the
369b33
first one.
5b2912
5b2912
Signed-off-by: Peter Lemenkov <lemenkov@redhat.com>
5b2912
5b2912
diff --git a/src/rabbit_nodes.erl b/src/rabbit_nodes.erl
9a3499
index 84069f3..218f789 100644
5b2912
--- a/src/rabbit_nodes.erl
5b2912
+++ b/src/rabbit_nodes.erl
369b33
@@ -221,9 +221,14 @@ set_cluster_name(Name) ->
5b2912
 ensure_epmd() ->
5b2912
     {ok, Prog} = init:get_argument(progname),
5b2912
     ID = rabbit_misc:random(1000000000),
369b33
+    ProtoDist = case init:get_argument(proto_dist) of
369b33
+            {ok, [Proto | _Protos]} -> Proto;
369b33
+            error -> "inet_tcp"
369b33
+    end,
5b2912
     Port = open_port(
5b2912
              {spawn_executable, os:find_executable(Prog)},
5b2912
              [{args, ["-sname", rabbit_misc:format("epmd-starter-~b", [ID]),
5b2912
+                      "-proto_dist", rabbit_misc:format("~p", [ProtoDist]),
5b2912
                       "-noshell", "-eval", "halt()."]},
5b2912
               exit_status, stderr_to_stdout, use_stdio]),
5b2912
     port_shutdown_loop(Port).