Set `$RABBITMQ_SCRIPTS_DIR` when calling CLI
This helps in situations where rabbitmq-env guesses it wrong. I saw this situation in the `feature_flags_SUITE` testsuite of rabbitmq-server, but couldn't really explain why the guess was wrong.
This commit is contained in:
parent
e2924bd76c
commit
60e1bd59ff
|
|
@ -959,6 +959,7 @@ rabbitmqctl(Config, Node, Args) ->
|
|||
NodeConfig = get_node_config(Config, Node),
|
||||
Nodename = ?config(nodename, NodeConfig),
|
||||
Env0 = [
|
||||
{"RABBITMQ_SCRIPTS_DIR", filename:dirname(Rabbitmqctl)},
|
||||
{"RABBITMQ_PID_FILE", ?config(pid_file, NodeConfig)},
|
||||
{"RABBITMQ_MNESIA_DIR", ?config(mnesia_dir, NodeConfig)},
|
||||
{"RABBITMQ_PLUGINS_DIR", ?config(plugins_dir, NodeConfig)},
|
||||
|
|
@ -989,6 +990,7 @@ rabbitmq_queues(Config, Node, Args) ->
|
|||
NodeConfig = rabbit_ct_broker_helpers:get_node_config(Config, Node),
|
||||
Nodename = ?config(nodename, NodeConfig),
|
||||
Env0 = [
|
||||
{"RABBITMQ_SCRIPTS_DIR", filename:dirname(RabbitmqQueues)},
|
||||
{"RABBITMQ_PID_FILE", ?config(pid_file, NodeConfig)},
|
||||
{"RABBITMQ_MNESIA_DIR", ?config(mnesia_dir, NodeConfig)},
|
||||
{"RABBITMQ_PLUGINS_DIR", ?config(plugins_dir, NodeConfig)},
|
||||
|
|
@ -1639,6 +1641,7 @@ plugin_action(Config, Node, Args) ->
|
|||
NodeConfig = get_node_config(Config, Node),
|
||||
Nodename = ?config(nodename, NodeConfig),
|
||||
Env = [
|
||||
{"RABBITMQ_SCRIPTS_DIR", filename:dirname(Rabbitmqplugins)},
|
||||
{"RABBITMQ_PID_FILE", ?config(pid_file, NodeConfig)},
|
||||
{"RABBITMQ_MNESIA_DIR", ?config(mnesia_dir, NodeConfig)},
|
||||
{"RABBITMQ_PLUGINS_DIR", ?config(plugins_dir, NodeConfig)},
|
||||
|
|
|
|||
|
|
@ -367,7 +367,10 @@ ensure_rabbitmqctl_cmd(Config) ->
|
|||
Error;
|
||||
_ ->
|
||||
Cmd = [Rabbitmqctl],
|
||||
case exec(Cmd, [drop_stdout]) of
|
||||
Env = [
|
||||
{"RABBITMQ_SCRIPTS_DIR", filename:dirname(Rabbitmqctl)}
|
||||
],
|
||||
case exec(Cmd, [drop_stdout, {env, Env}]) of
|
||||
{error, 64, _} ->
|
||||
set_config(Config, {rabbitmqctl_cmd, Rabbitmqctl});
|
||||
{error, Code, Reason} ->
|
||||
|
|
@ -440,7 +443,10 @@ ensure_rabbitmq_plugins_cmd(Config) ->
|
|||
Error;
|
||||
_ ->
|
||||
Cmd = [Rabbitmqplugins],
|
||||
case exec(Cmd, [drop_stdout]) of
|
||||
Env = [
|
||||
{"RABBITMQ_SCRIPTS_DIR", filename:dirname(Rabbitmqplugins)}
|
||||
],
|
||||
case exec(Cmd, [drop_stdout, {env, Env}]) of
|
||||
{error, 64, _} ->
|
||||
set_config(Config, {rabbitmq_plugins_cmd, Rabbitmqplugins});
|
||||
_ ->
|
||||
|
|
@ -464,7 +470,10 @@ ensure_rabbitmq_queues_cmd(Config) ->
|
|||
Error;
|
||||
_ ->
|
||||
Cmd = [RabbitmqQueues],
|
||||
case exec(Cmd, [drop_stdout]) of
|
||||
Env = [
|
||||
{"RABBITMQ_SCRIPTS_DIR", filename:dirname(RabbitmqQueues)}
|
||||
],
|
||||
case exec(Cmd, [drop_stdout, {env, Env}]) of
|
||||
{error, 64, _} ->
|
||||
set_config(Config,
|
||||
{rabbitmq_queues_cmd,
|
||||
|
|
|
|||
Loading…
Reference in New Issue