refactor(cli): simplify ACL cache CLI logging

This commit is contained in:
Zaiming (Stone) Shi 2022-02-13 22:16:27 +01:00
parent f6ca64c76d
commit 91180595d0
1 changed files with 4 additions and 14 deletions

View File

@ -577,21 +577,11 @@ data(_) ->
%% @doc acl Command %% @doc acl Command
acl(["cache-clean", "node", Node]) -> acl(["cache-clean", "node", Node]) ->
case for_node(fun emqx_mgmt:clean_acl_cache_all/1, Node) of with_log(fun() -> for_node(fun emqx_mgmt:clean_acl_cache_all/1, Node) end,
ok -> "ACL cache drain start");
emqx_ctl:print("ACL cache drain started on node ~s.~n", [Node]);
{error, Reason} ->
emqx_ctl:print("ACL drain failed on node ~s: ~0p.~n", [Node, Reason])
end;
acl(["cache-clean", "all"]) -> acl(["cache-clean", "all"]) ->
case emqx_mgmt:clean_acl_cache_all() of with_log(fun emqx_mgmt:clean_acl_cache_all/1,
ok -> "ACL cache drain start");
emqx_ctl:print("Started ACL cache drain in all nodes~n");
{error, Reason} ->
emqx_ctl:print("ACL cache-clean failed: ~p.~n", [Reason])
end;
acl(["cache-clean", ClientId]) -> acl(["cache-clean", ClientId]) ->
emqx_mgmt:clean_acl_cache(ClientId); emqx_mgmt:clean_acl_cache(ClientId);