Skip to content

Commit f8d7977

Browse files
committed
Shovels: return hosting node in terminated shovel status
Fixes deletion and restart
1 parent 8cde128 commit f8d7977

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

deps/rabbitmq_shovel/src/Elixir.RabbitMQ.CLI.Ctl.Commands.DeleteShovelCommand.erl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ run([Name], #{node := Node, vhost := VHost, force := Force}) ->
8282
{error, rabbit_data_coercion:to_binary(ErrMsg)};
8383
{{_Name, _VHost}, _Type, {terminated, _}, _Metrics, _Timestamp} ->
8484
delete_shovel(ErrMsg, VHost, Name, ActingUser, Node, Node);
85-
{{_Name, _VHost}, _Type, {terminated, HostingNode, _}, _Metrics, _Timestamp} ->
85+
{{_Name, _VHost}, _Type, {terminated, Opts, _}, _Metrics, _Timestamp} ->
86+
HostingNode = proplists:get_value(node, Opts, Node),
8687
delete_shovel(ErrMsg, VHost, Name, ActingUser, HostingNode, Node);
8788
{{_Name, _VHost}, _Type, {_State, Opts}, _Metrics, _Timestamp} ->
8889
HostingNode = proplists:get_value(node, Opts, Node),

deps/rabbitmq_shovel/src/Elixir.RabbitMQ.CLI.Ctl.Commands.RestartShovelCommand.erl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ run([Name], #{node := Node, vhost := VHost}) ->
6262
case rabbit_shovel_status:find_matching_shovel(VHost, Name, Xs) of
6363
undefined ->
6464
{error, rabbit_data_coercion:to_binary(ErrMsg)};
65+
{{_Name, _VHost}, _Type, {terminated, Opts, _}, _Metrics, _Timestamp} ->
66+
restart_shovel(ErrMsg, Name, VHost, Opts);
6567
{{_Name, _VHost}, _Type, {_State, Opts}, _Metrics, _Timestamp} ->
6668
restart_shovel(ErrMsg, Name, VHost, Opts);
6769
{{_Name, _VHost}, _Type, {_State, Opts}, _Timestamp} ->

deps/rabbitmq_shovel/src/rabbit_shovel_status.erl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
| {terminated, term()}.
4545
-type info_with_node() :: starting
4646
| {running, proplists:proplist()}
47-
| {terminated, node(), term()}.
47+
| {terminated, proplists:proplist(), term()}.
4848
-type blocked_status() :: running | flow | blocked.
4949
-type shovel_status() :: blocked_status() | ignore.
5050

@@ -219,7 +219,7 @@ inject_node_info(Node, Shovels) ->
219219
{Name, Type, {State, Opts}, Metrics, Timestamp};
220220
%% terminated
221221
({Name, Type, {terminated, Reason}, Metrics, Timestamp}) ->
222-
{Name, Type, {terminated, Node, Reason}, Metrics, Timestamp};
222+
{Name, Type, {terminated, [{node, Node}], Reason}, Metrics, Timestamp};
223223
%% running
224224
({Name, Type, {State, Opts}, Metrics, Timestamp}) ->
225225
Opts1 = Opts ++ [{node, Node}],

0 commit comments

Comments
 (0)