Skip to content

Commit d45f176

Browse files
Merge pull request #14059 from rabbitmq/mergify/bp/v4.1.x/pr-14057
CT broker helpers: use rabbitmq-plugins from the given node with a secondary umbrella (backport #14057)
2 parents c74ae70 + 9c6f495 commit d45f176

File tree

1 file changed

+47
-1
lines changed

1 file changed

+47
-1
lines changed

deps/rabbitmq_ct_helpers/src/rabbit_ct_broker_helpers.erl

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2370,9 +2370,55 @@ disable_plugin(Config, Node, Plugin) ->
23702370
plugin_action(Config, Node, [disable, Plugin]).
23712371

23722372
plugin_action(Config, Node, Args) ->
2373-
Rabbitmqplugins = ?config(rabbitmq_plugins_cmd, Config),
23742373
NodeConfig = get_node_config(Config, Node),
23752374
Nodename = ?config(nodename, NodeConfig),
2375+
%% We want to use the CLI from the given node if there is a secondary
2376+
%% umbrella being configured.
2377+
I = get_node_index(Config, Node),
2378+
CanUseSecondary = (I + 1) rem 2 =:= 0,
2379+
WithPlugins0 = rabbit_ct_helpers:get_config(Config,
2380+
broker_with_plugins),
2381+
WithPlugins = case is_list(WithPlugins0) of
2382+
true -> lists:nth(I + 1, WithPlugins0);
2383+
false -> WithPlugins0
2384+
end,
2385+
UseSecondaryDist = case ?config(secondary_dist, Config) of
2386+
false -> false;
2387+
_ -> CanUseSecondary
2388+
end,
2389+
UseSecondaryUmbrella = case ?config(secondary_umbrella, Config) of
2390+
false ->
2391+
false;
2392+
_ ->
2393+
CanUseSecondary
2394+
end,
2395+
Rabbitmqplugins = case UseSecondaryUmbrella of
2396+
true ->
2397+
SrcDir = case WithPlugins of
2398+
false ->
2399+
?config(
2400+
secondary_rabbit_srcdir,
2401+
Config);
2402+
_ ->
2403+
?config(
2404+
secondary_current_srcdir,
2405+
Config)
2406+
end,
2407+
SecScriptsDir = filename:join(
2408+
[SrcDir, "sbin"]),
2409+
rabbit_misc:format(
2410+
"~ts/rabbitmq-plugins", [SecScriptsDir]);
2411+
false ->
2412+
case UseSecondaryDist of
2413+
true ->
2414+
SecondaryDist = ?config(secondary_dist, Config),
2415+
rabbit_misc:format(
2416+
"~ts/sbin/rabbitmq-plugins", [SecondaryDist]);
2417+
false ->
2418+
?config(rabbitmq_plugins_cmd, Config)
2419+
end
2420+
end,
2421+
23762422
Env = [
23772423
{"RABBITMQ_SCRIPTS_DIR", filename:dirname(Rabbitmqplugins)},
23782424
{"RABBITMQ_PID_FILE", ?config(pid_file, NodeConfig)},

0 commit comments

Comments
 (0)