@@ -76,27 +76,32 @@ run([Name], #{node := Node, vhost := VHost}) ->
76
76
undefined ->
77
77
try_force_removing (Node , VHost , Name , ActingUser ),
78
78
{error , rabbit_data_coercion :to_binary (ErrMsg )};
79
- Match ->
80
- {{_Name , _VHost }, _Type , {_State , Opts }, _Timestamp } = Match ,
81
- {_ , HostingNode } = lists :keyfind (node , 1 , Opts ),
82
- case rabbit_misc :rpc_call (
83
- HostingNode , rabbit_shovel_util , delete_shovel , [VHost , Name , ActingUser ]) of
84
- {badrpc , _ } = Error ->
85
- Error ;
86
- {error , not_found } ->
87
- ErrMsg = rabbit_misc :format (" Shovel with the given name was not found "
88
- " on the target node '~ts ' and/or virtual host '~ts '. "
89
- " It may be failing to connect and report its state, will delete its runtime parameter..." ,
90
- [Node , VHost ]),
91
- try_force_removing (HostingNode , VHost , Name , ActingUser ),
92
- {error , rabbit_data_coercion :to_binary (ErrMsg )};
93
- ok ->
94
- _ = try_clearing_runtime_parameter (Node , VHost , Name , ActingUser ),
95
- ok
96
- end
79
+ {{_Name , _VHost }, _Type , {_State , Opts }, _Timestamp } ->
80
+ delete_shovel (ErrMsg , VHost , Opts , Name , Node , ActingUser );
81
+ % % Forward compatibility with >= 4.1
82
+ {{_Name , _VHost }, _Type , {_State , Opts }, _Metrics , _Timestamp } ->
83
+ delete_shovel (ErrMsg , VHost , Opts , Name , Node , ActingUser )
97
84
end
98
85
end .
99
86
87
+ delete_shovel (ErrMsg , VHost , Opts , Name , Node , ActingUser ) ->
88
+ {_ , HostingNode } = lists :keyfind (node , 1 , Opts ),
89
+ case rabbit_misc :rpc_call (
90
+ HostingNode , rabbit_shovel_util , delete_shovel , [VHost , Name , ActingUser ]) of
91
+ {badrpc , _ } = Error ->
92
+ Error ;
93
+ {error , not_found } ->
94
+ ErrMsg = rabbit_misc :format (" Shovel with the given name was not found "
95
+ " on the target node '~ts ' and/or virtual host '~ts '. "
96
+ " It may be failing to connect and report its state, will delete its runtime parameter..." ,
97
+ [Node , VHost ]),
98
+ try_force_removing (HostingNode , VHost , Name , ActingUser ),
99
+ {error , rabbit_data_coercion :to_binary (ErrMsg )};
100
+ ok ->
101
+ _ = try_clearing_runtime_parameter (Node , VHost , Name , ActingUser ),
102
+ ok
103
+ end .
104
+
100
105
switches () ->
101
106
[].
102
107
0 commit comments