feat: add edition info to /nodes api
This commit is contained in:
parent
c695e67e18
commit
d447659365
|
@ -45,9 +45,10 @@ set_prompt_func() ->
|
||||||
prompt_func(PropList) ->
|
prompt_func(PropList) ->
|
||||||
Line = proplists:get_value(history, PropList, 1),
|
Line = proplists:get_value(history, PropList, 1),
|
||||||
Version = emqx_release:version(),
|
Version = emqx_release:version(),
|
||||||
|
Edition = emqx_release:edition(),
|
||||||
case is_alive() of
|
case is_alive() of
|
||||||
true -> io_lib:format(<<"~ts(~s)~w> ">>, [Version, node(), Line]);
|
true -> io_lib:format(<<"~ts-~ts(~s)~w> ">>, [Edition, Version, node(), Line]);
|
||||||
false -> io_lib:format(<<"~ts ~w> ">>, [Version, Line])
|
false -> io_lib:format(<<"~ts-~ts ~w> ">>, [Edition, Version, Line])
|
||||||
end.
|
end.
|
||||||
|
|
||||||
local_allowed(MF, Args, State) ->
|
local_allowed(MF, Args, State) ->
|
||||||
|
|
|
@ -141,6 +141,7 @@ node_info() ->
|
||||||
node_status => 'running',
|
node_status => 'running',
|
||||||
uptime => proplists:get_value(uptime, BrokerInfo),
|
uptime => proplists:get_value(uptime, BrokerInfo),
|
||||||
version => iolist_to_binary(proplists:get_value(version, BrokerInfo)),
|
version => iolist_to_binary(proplists:get_value(version, BrokerInfo)),
|
||||||
|
edition => edition(),
|
||||||
role => mria_rlog:role()
|
role => mria_rlog:role()
|
||||||
}.
|
}.
|
||||||
|
|
||||||
|
@ -553,3 +554,9 @@ max_row_limit() ->
|
||||||
?MAX_ROW_LIMIT.
|
?MAX_ROW_LIMIT.
|
||||||
|
|
||||||
table_size(Tab) -> ets:info(Tab, size).
|
table_size(Tab) -> ets:info(Tab, size).
|
||||||
|
|
||||||
|
edition() ->
|
||||||
|
case emqx_release:edition() of
|
||||||
|
ee -> <<"enterprise">>;
|
||||||
|
ce -> <<"community">>
|
||||||
|
end.
|
||||||
|
|
|
@ -215,7 +215,12 @@ fields(node_info) ->
|
||||||
{version,
|
{version,
|
||||||
mk(
|
mk(
|
||||||
string(),
|
string(),
|
||||||
#{desc => <<"Release version">>, example => "5.0.0-beat.3-00000000"}
|
#{desc => <<"Release version">>, example => "5.0.0"}
|
||||||
|
)},
|
||||||
|
{edition,
|
||||||
|
mk(
|
||||||
|
enum([community, enterprise]),
|
||||||
|
#{desc => <<"Release edition">>, example => "community"}
|
||||||
)},
|
)},
|
||||||
{sys_path,
|
{sys_path,
|
||||||
mk(
|
mk(
|
||||||
|
|
|
@ -57,6 +57,11 @@ t_nodes_api(_) ->
|
||||||
LocalNodeInfo = hd(NodesResponse),
|
LocalNodeInfo = hd(NodesResponse),
|
||||||
Node = binary_to_atom(maps:get(<<"node">>, LocalNodeInfo), utf8),
|
Node = binary_to_atom(maps:get(<<"node">>, LocalNodeInfo), utf8),
|
||||||
?assertEqual(Node, node()),
|
?assertEqual(Node, node()),
|
||||||
|
Edition = maps:get(<<"edition">>, LocalNodeInfo),
|
||||||
|
case emqx_release:edition() of
|
||||||
|
ee -> ?assertEqual(<<"enterprise">>, Edition);
|
||||||
|
ce -> ?assertEqual(<<"community">>, Edition)
|
||||||
|
end,
|
||||||
|
|
||||||
NodePath = emqx_mgmt_api_test_util:api_path(["nodes", atom_to_list(node())]),
|
NodePath = emqx_mgmt_api_test_util:api_path(["nodes", atom_to_list(node())]),
|
||||||
{ok, NodeInfo} = emqx_mgmt_api_test_util:request_api(get, NodePath),
|
{ok, NodeInfo} = emqx_mgmt_api_test_util:request_api(get, NodePath),
|
||||||
|
|
Loading…
Reference in New Issue