diff options
| author | Ayanda Dube <ayanda.dube@erlang-solutions.com> | 2015-09-08 16:14:43 +0100 |
|---|---|---|
| committer | Ayanda Dube <ayanda.dube@erlang-solutions.com> | 2015-10-07 08:46:40 +0100 |
| commit | 383defe127d93b13fc7b1ec10a977a5e8f43f189 (patch) | |
| tree | 455f19808e4ad5b1d92288a31883cb4c86aae42b /src | |
| parent | 19fa31319b4e50e207d59d668c6ec4fbcf2052c0 (diff) | |
| download | rabbitmq-server-git-383defe127d93b13fc7b1ec10a977a5e8f43f189.tar.gz | |
Adds rpc_call/7 for remote calls for dynamic listing of info.
Adds 'function_clause' case match to handle commands with invalid parameters.
References #62
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_cli.erl | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/rabbit_cli.erl b/src/rabbit_cli.erl index 33098ce16b..6147f7a120 100644 --- a/src/rabbit_cli.erl +++ b/src/rabbit_cli.erl @@ -18,7 +18,7 @@ -include("rabbit_cli.hrl"). -export([main/3, start_distribution/0, start_distribution/1, - parse_arguments/4, rpc_call/4, rpc_call/5]). + parse_arguments/4, rpc_call/4, rpc_call/5, rpc_call/7]). %%---------------------------------------------------------------------------- @@ -39,6 +39,8 @@ ([{atom(), [{string(), optdef()}]} | atom()], [{string(), optdef()}], string(), [string()]) -> parse_result()). -spec(rpc_call/4 :: (node(), atom(), atom(), [any()]) -> any()). +-spec(rpc_call/5 :: (node(), atom(), atom(), [any()]) -> any()). +-spec(rpc_call/7 :: (node(), atom(), atom(), [any()]) -> any()). -endif. @@ -106,6 +108,9 @@ main(ParseFun, DoFun, UsageMod) -> print_error("unable to connect to nodes ~p: ~w", [Nodes, Reason]), print_badrpc_diagnostics(Nodes), rabbit_misc:quit(2); + function_clause -> + print_error("invalid parameter: ~p", [Args]), + usage(UsageMod); Other -> print_error("~p", [Other]), rabbit_misc:quit(2) @@ -223,3 +228,11 @@ rpc_call(Node, Mod, Fun, Args, Timeout) -> Time -> net_kernel:set_net_ticktime(Time, 0), rpc:call(Node, Mod, Fun, Args, Timeout) end. + +rpc_call(Node, Mod, Fun, Args, Ref, Pid, Timeout) -> + case rpc:call(Node, net_kernel, get_net_ticktime, [], Timeout) of + {badrpc, _} = E -> E; + Time -> net_kernel:set_net_ticktime(Time, 0), + rpc:call(Node, Mod, Fun, Args++[Ref, Pid], Timeout) + end. + |
