Merge pull request #6505 from JimMoen/v4.x-fix-node-info-format

fix(mgmt): fix node info format for specific node
This commit is contained in:
JimMoen 2021-12-31 13:39:43 +08:00 committed by GitHub
commit bec742b1be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 5 deletions

View File

@ -1,6 +1,6 @@
{application, emqx_management,
[{description, "EMQ X Management API and CLI"},
{vsn, "4.3.9"}, % strict semver, bump manually!
{vsn, "4.3.10"}, % strict semver, bump manually!
{modules, []},
{registered, [emqx_management_sup]},
{applications, [kernel,stdlib,minirest]},

View File

@ -1,13 +1,13 @@
%% -*- mode: erlang -*-
{VSN,
[ {<<"4\\.3\\.[0-8]+">>,
[ {<<"4\\.3\\.[0-9]+">>,
[ {apply,{minirest,stop_http,['http:management']}},
{apply,{minirest,stop_http,['https:management']}},
{restart_application, emqx_management}
]},
{<<".*">>, []}
],
[ {<<"4\\.3\\.[0-8]+">>,
[ {<<"4\\.3\\.[0-9]+">>,
[ {apply,{minirest,stop_http,['http:management']}},
{apply,{minirest,stop_http,['https:management']}},
{restart_application, emqx_management}

View File

@ -36,11 +36,10 @@ list(_Bindings, _Params) ->
minirest:return({ok, [format(Node, Info) || {Node, Info} <- emqx_mgmt:list_nodes()]}).
get(#{node := Node}, _Params) ->
minirest:return({ok, emqx_mgmt:lookup_node(Node)}).
minirest:return({ok, format(Node, emqx_mgmt:lookup_node(Node))}).
format(Node, {error, Reason}) -> #{node => Node, error => Reason};
format(_Node, Info = #{memory_total := Total, memory_used := Used}) ->
Info#{memory_total := emqx_mgmt_util:kmg(Total),
memory_used := emqx_mgmt_util:kmg(Used)}.