rabbitmq_peer_discovery_consul: Log output from Consul daemon

[Why]
It helps diagnose any startup issues. Typically a problem with the
configuration where the log file is not yet created.
This commit is contained in:
Jean-Sébastien Pédron 2024-12-02 10:20:59 +01:00
parent f4d61d2775
commit b03f0bd07d
No known key found for this signature in database
GPG Key ID: 39E99761A5FD94CC
1 changed files with 11 additions and 1 deletions

View File

@ -202,9 +202,19 @@ start_consul(Config) ->
Cmd = [ConsulBin, "agent",
"-config-dir", ConsulConfDir,
"-log-file", LogFile],
ConsulPid = spawn(fun() -> rabbit_ct_helpers:exec(Cmd) end),
ConsulPid = spawn(fun() -> do_start_consul(Cmd) end),
rabbit_ct_helpers:set_config(Config, {consul_pid, ConsulPid}).
do_start_consul(Cmd) ->
case rabbit_ct_helpers:exec(Cmd) of
{ok, Stdout} ->
ct:pal("Consul daemon exited:~n~s", [Stdout]);
{error, Reason, Stdout} ->
ct:pal(
"Consul daemon exited with error ~0p:~n~s",
[Reason, Stdout])
end.
stop_consul(Config) ->
case rabbit_ct_helpers:get_config(Config, consul_pid) of
ConsulPid when is_pid(ConsulPid) ->