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
8f6ae3
diff --git a/src/rabbit_nodes_common.erl b/src/rabbit_nodes_common.erl
f7d02c
index f06c3d0..63c35ec 100644
8f6ae3
--- a/src/rabbit_nodes_common.erl
8f6ae3
+++ b/src/rabbit_nodes_common.erl
f7d02c
@@ -80,10 +80,15 @@ do_ensure_epmd(false, Prog) ->
1d1d3c
     rabbit_log:error("ensure_epmd: unable to find executable '~s' in PATH: '~s'", [Prog, Path]);
1d1d3c
 do_ensure_epmd(Exe, _) ->
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).