fix: api file path with filename:join(List) & app up

This commit is contained in:
DDDHuang 2022-03-14 15:08:34 +08:00
parent 2da3333879
commit 1ec0377a69
3 changed files with 22 additions and 8 deletions

View File

@ -1,6 +1,6 @@
{application, emqx_plugin_libs, {application, emqx_plugin_libs,
[{description, "EMQ X Plugin utility libs"}, [{description, "EMQ X Plugin utility libs"},
{vsn, "4.4.1"}, {vsn, "4.4.2"},
{modules, []}, {modules, []},
{applications, [kernel,stdlib]}, {applications, [kernel,stdlib]},
{env, []} {env, []}

View File

@ -1,12 +1,24 @@
%% -*- mode: erlang -*- %% -*- mode: erlang -*-
{VSN, {VSN,
[{"4.4.0", [{"4.4.1",
[ {update, emqx_slow_subs, {advanced, ["4.4.0"]}} [ {load_module,emqx_trace,brutal_purge,soft_purge,[]}
, {load_module,emqx_trace_api,brutal_purge,soft_purge,[]}
]},
{"4.4.0",
[ {load_module,emqx_trace,brutal_purge,soft_purge,[]}
, {load_module,emqx_trace_api,brutal_purge,soft_purge,[]}
, {update, emqx_slow_subs, {advanced, ["4.4.0"]}}
, {load_module,emqx_slow_subs_api,brutal_purge,soft_purge,[]} , {load_module,emqx_slow_subs_api,brutal_purge,soft_purge,[]}
]}, ]},
{<<".*">>,[]}], {<<".*">>,[]}],
[{"4.4.0", [{"4.4.1",
[ {update, emqx_slow_subs, {advanced, ["4.4.0"]}} [ {load_module,emqx_trace,brutal_purge,soft_purge,[]}
, {load_module,emqx_trace_api,brutal_purge,soft_purge,[]}
]},
{"4.4.0",
[ {load_module,emqx_trace,brutal_purge,soft_purge,[]}
, {load_module,emqx_trace_api,brutal_purge,soft_purge,[]}
, {update, emqx_slow_subs, {advanced, ["4.4.0"]}}
, {load_module,emqx_slow_subs_api,brutal_purge,soft_purge,[]} , {load_module,emqx_slow_subs_api,brutal_purge,soft_purge,[]}
]}, ]},
{<<".*">>,[]}] {<<".*">>,[]}]

View File

@ -95,7 +95,8 @@ download_zip_log(#{name := Name}, _Param) ->
TraceFiles = collect_trace_file(TraceLog), TraceFiles = collect_trace_file(TraceLog),
ZipDir = emqx_trace:zip_dir(), ZipDir = emqx_trace:zip_dir(),
Zips = group_trace_file(ZipDir, TraceLog, TraceFiles), Zips = group_trace_file(ZipDir, TraceLog, TraceFiles),
ZipFileName = ZipDir ++ binary_to_list(Name) ++ ".zip", ZipFileName0 = binary_to_list(Name) ++ ".zip",
ZipFileName = filename:join([Zips, ZipFileName0]),
{ok, ZipFile} = zip:zip(ZipFileName, Zips, [{cwd, ZipDir}]), {ok, ZipFile} = zip:zip(ZipFileName, Zips, [{cwd, ZipDir}]),
emqx_trace:delete_files_after_send(ZipFileName, Zips), emqx_trace:delete_files_after_send(ZipFileName, Zips),
{ok, ZipFile}; {ok, ZipFile};
@ -107,9 +108,10 @@ group_trace_file(ZipDir, TraceLog, TraceFiles) ->
lists:foldl(fun(Res, Acc) -> lists:foldl(fun(Res, Acc) ->
case Res of case Res of
{ok, Node, Bin} -> {ok, Node, Bin} ->
ZipName = ZipDir ++ Node ++ "-" ++ TraceLog, FileName = Node ++ "-" ++ TraceLog,
ZipName = filename:join([ZipDir, FileName]),
case file:write_file(ZipName, Bin) of case file:write_file(ZipName, Bin) of
ok -> [Node ++ "-" ++ TraceLog | Acc]; ok -> [FileName | Acc];
_ -> Acc _ -> Acc
end; end;
{error, Node, Reason} -> {error, Node, Reason} ->