diff --git a/apps/emqx_plugins/src/emqx_plugins.erl b/apps/emqx_plugins/src/emqx_plugins.erl index 7465b5ff1..722a2152c 100644 --- a/apps/emqx_plugins/src/emqx_plugins.erl +++ b/apps/emqx_plugins/src/emqx_plugins.erl @@ -193,7 +193,7 @@ purge(NameVsn) -> %% @doc Delete the package file. -spec delete_package(name_vsn()) -> ok. delete_package(NameVsn) -> - File = pkg_file(NameVsn), + File = pkg_file_path(NameVsn), _ = emqx_plugins_serde:delete_schema(NameVsn), case file:delete(File) of ok -> @@ -317,7 +317,7 @@ put_config(Key, Value) -> -spec get_tar(name_vsn()) -> {ok, binary()} | {error, any}. get_tar(NameVsn) -> - TarGz = pkg_file(NameVsn), + TarGz = pkg_file_path(NameVsn), case file:read_file(TarGz) of {ok, Content} -> {ok, Content}; @@ -407,7 +407,7 @@ top_dir_test_() -> -endif. do_ensure_installed(NameVsn) -> - TarGz = pkg_file(NameVsn), + TarGz = pkg_file_path(NameVsn), case erl_tar:extract(TarGz, [compressed, memory]) of {ok, TarContent} -> ok = write_tar_file_content(install_dir(), TarContent), @@ -633,7 +633,7 @@ ensure_exists_and_installed(NameVsn) -> %% Do we have the package, but it's not extracted yet? case get_tar(NameVsn) of {ok, TarContent} -> - ok = file:write_file(pkg_file(NameVsn), TarContent), + ok = file:write_file(pkg_file_path(NameVsn), TarContent), ok = do_ensure_installed(NameVsn); _ -> %% If not, try to get it from the cluster. @@ -645,7 +645,7 @@ do_get_from_cluster(NameVsn) -> Nodes = [N || N <- mria:running_nodes(), N /= node()], case get_from_any_node(Nodes, NameVsn, []) of {ok, TarContent} -> - ok = file:write_file(pkg_file(NameVsn), TarContent), + ok = file:write_file(pkg_file_path(NameVsn), TarContent), ok = do_ensure_installed(NameVsn); {error, NodeErrors} when Nodes =/= [] -> ?SLOG(error, #{ @@ -1073,7 +1073,7 @@ plugin_config_dir(NameVsn) -> filename:join([plugin_dir(NameVsn), "data", "configs"]). %% Files -pkg_file(NameVsn) -> +pkg_file_path(NameVsn) -> filename:join([install_dir(), bin([NameVsn, ".tar.gz"])]). info_file_path(NameVsn) -> diff --git a/apps/emqx_plugins/test/emqx_plugins_tests.erl b/apps/emqx_plugins/test/emqx_plugins_tests.erl index 910c30564..fb4277c4f 100644 --- a/apps/emqx_plugins/test/emqx_plugins_tests.erl +++ b/apps/emqx_plugins/test/emqx_plugins_tests.erl @@ -56,7 +56,7 @@ read_plugin_test() -> try ok = write_file(InfoFile, FakeInfo), ?assertMatch( - {error, #{error := "bad_rel_apps"}}, + {error, #{error_msg := "bad_rel_apps"}}, emqx_plugins:read_plugin_info(NameVsn, #{}) ) after