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

fix(plugins): create directory before uploading

Fixes https://emqx.atlassian.net/browse/EMQX-9434

Fixes https://github.com/emqx/emqx-elixir-plugin/issues/23
Thales Macedo Garitezi 2 лет назад
Родитель
Сommit
a2b82dae69
3 измененных файлов с 5 добавлено и 0 удалено
  1. 1 0
      apps/emqx_management/src/emqx_mgmt_api_plugins.erl
  2. 1 0
      changes/ce/fix-10300.en.md
  3. 3 0
      mix.exs

+ 1 - 0
apps/emqx_management/src/emqx_mgmt_api_plugins.erl

@@ -428,6 +428,7 @@ update_boot_order(post, #{bindings := #{name := Name}, body := Body}) ->
 %% For RPC upload_install/2
 install_package(FileName, Bin) ->
     File = filename:join(emqx_plugins:install_dir(), FileName),
+    ok = filelib:ensure_dir(File),
     ok = file:write_file(File, Bin),
     PackageName = string:trim(FileName, trailing, ".tar.gz"),
     case emqx_plugins:ensure_installed(PackageName) of

+ 1 - 0
changes/ce/fix-10300.en.md

@@ -0,0 +1 @@
+Fixed an issue where a build made with Elixir could not receive uploaded plugins until the `plugins` folder was created manually to receive the uploaded files.

+ 3 - 0
mix.exs

@@ -394,10 +394,12 @@ defmodule EMQXUmbrella.MixProject do
     bin = Path.join(release.path, "bin")
     etc = Path.join(release.path, "etc")
     log = Path.join(release.path, "log")
+    plugins = Path.join(release.path, "plugins")
 
     Mix.Generator.create_directory(bin)
     Mix.Generator.create_directory(etc)
     Mix.Generator.create_directory(log)
+    Mix.Generator.create_directory(plugins)
     Mix.Generator.create_directory(Path.join(etc, "certs"))
 
     Enum.each(
@@ -610,6 +612,7 @@ defmodule EMQXUmbrella.MixProject do
       &[
         "etc",
         "data",
+        "plugins",
         "bin/node_dump"
         | &1
       ]