Просмотр исходного кода

fix(cli): Stop http listener without port number

Zaiming Shi 5 лет назад
Родитель
Сommit
65f3a2b685
1 измененных файлов с 4 добавлено и 3 удалено
  1. 4 3
      lib-opensource/emqx_management/src/emqx_mgmt_cli.erl

+ 4 - 3
lib-opensource/emqx_management/src/emqx_mgmt_cli.erl

@@ -530,12 +530,13 @@ listeners([]) ->
                 foreach(fun indent_print/1, Info)
                 foreach(fun indent_print/1, Info)
             end, ranch:info());
             end, ranch:info());
 
 
-listeners(["stop",  Name = "http" ++ _N, ListenOn]) ->
+listeners(["stop",  Name = "http" ++ _N | _MaybePort]) ->
+    %% _MaybePort is to be backward compatible, to stop http listener, there is no need for the port number
     case minirest:stop_http(list_to_atom(Name)) of
     case minirest:stop_http(list_to_atom(Name)) of
         ok ->
         ok ->
-            emqx_ctl:print("Stop ~s listener on ~s successfully.~n", [Name, ListenOn]);
+            emqx_ctl:print("Stop ~s listener successfully.~n", [Name]);
         {error, Error} ->
         {error, Error} ->
-            emqx_ctl:print("Failed to stop ~s listener on ~s, error:~p~n", [Name, ListenOn, Error])
+            emqx_ctl:print("Failed to stop ~s listener, error:~p~n", [Name, Error])
     end;
     end;
 
 
 listeners(["stop", "mqtt:" ++ _ = Identifier]) ->
 listeners(["stop", "mqtt:" ++ _ = Identifier]) ->