Blame rabbitmq-server-0003-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
889a63
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
5b2912
889a63
diff --git a/deps/rabbit_common/src/rabbit_nodes_common.erl b/deps/rabbit_common/src/rabbit_nodes_common.erl
889a63
index 9d72c29652..fd02b30ede 100644
889a63
--- a/deps/rabbit_common/src/rabbit_nodes_common.erl
889a63
+++ b/deps/rabbit_common/src/rabbit_nodes_common.erl
889a63
@@ -105,10 +105,15 @@ epmd_port() ->
a1fb4b
 ensure_epmd() ->
a1fb4b
     Exe = rabbit_runtime:get_erl_path(),
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(
1d1d3c
              {spawn_executable, Exe},
f7d02c
              [{args, ["-boot", "no_dot_erlang",
f7d02c
                       "-sname", rabbit_misc:format("epmd-starter-~b", [ID]),
5b2912
+                      "-proto_dist", rabbit_misc:format("~p", [ProtoDist]),
f7d02c
                       "-noinput", "-s", "erlang", "halt"]},
5b2912
               exit_status, stderr_to_stdout, use_stdio]),
5b2912
     port_shutdown_loop(Port).