fix: make static check happy
This commit is contained in:
parent
d06f410fd5
commit
d2e0c09f2e
|
@ -519,7 +519,7 @@ plugin_config(put, #{bindings := #{name := Name}, body := #{<<"config">> := RawA
|
|||
plugin_schema(get, #{bindings := #{name := NameVsn}}) ->
|
||||
case emqx_plugins:describe(NameVsn) of
|
||||
{ok, _Plugin} ->
|
||||
{200, format_plugin_schema_with_i18n(NameVsn)};
|
||||
{200, format_plugin_avsc_and_i18n(NameVsn)};
|
||||
_ ->
|
||||
{404, #{
|
||||
code => 'NOT_FOUND',
|
||||
|
@ -685,7 +685,7 @@ aggregate_status([{Node, Plugins} | List], Acc) ->
|
|||
),
|
||||
aggregate_status(List, NewAcc).
|
||||
|
||||
format_plugin_schema_with_i18n(NameVsn) ->
|
||||
format_plugin_avsc_and_i18n(NameVsn) ->
|
||||
#{
|
||||
avsc => try_read_file(fun() -> emqx_plugins:plugin_avsc(NameVsn) end),
|
||||
i18n => try_read_file(fun() -> emqx_plugins:plugin_i18n(NameVsn) end)
|
||||
|
@ -693,7 +693,7 @@ format_plugin_schema_with_i18n(NameVsn) ->
|
|||
|
||||
try_read_file(Fun) ->
|
||||
case Fun() of
|
||||
{ok, Bin} -> Bin;
|
||||
{ok, Json} -> Json;
|
||||
_ -> null
|
||||
end.
|
||||
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
describe_package/2,
|
||||
delete_package/1,
|
||||
ensure_action/2
|
||||
%% plugin_config/2
|
||||
]).
|
||||
|
||||
-include_lib("emqx/include/bpapi.hrl").
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
%% -*- mode: erlang -*-
|
||||
|
||||
{deps, [{emqx, {path, "../emqx"}}]}.
|
||||
{deps, [
|
||||
{emqx, {path, "../emqx"}},
|
||||
{erlavro, {git, "https://github.com/emqx/erlavro.git", {tag, "2.10.0"}}}
|
||||
]}.
|
||||
|
||||
{project_plugins, [erlfmt]}.
|
||||
|
|
|
@ -4,6 +4,6 @@
|
|||
{vsn, "0.2.0"},
|
||||
{modules, []},
|
||||
{mod, {emqx_plugins_app, []}},
|
||||
{applications, [kernel, stdlib, emqx]},
|
||||
{applications, [kernel, stdlib, emqx, erlavro]},
|
||||
{env, []}
|
||||
]}.
|
||||
|
|
|
@ -62,7 +62,8 @@
|
|||
get_config/2,
|
||||
put_config/2,
|
||||
get_tar/1,
|
||||
install_dir/0
|
||||
install_dir/0,
|
||||
avsc_file_path/1
|
||||
]).
|
||||
|
||||
%% `emqx_config_handler' API
|
||||
|
@ -1027,9 +1028,17 @@ do_load_config_schema(NameVsn) ->
|
|||
end.
|
||||
|
||||
maybe_create_config_dir(NameVsn) ->
|
||||
case filelib:ensure_path(plugin_config_dir(NameVsn)) of
|
||||
ok -> ok;
|
||||
{error, Reason} -> ?SLOG(warning, Reason)
|
||||
ConfigDir = plugin_config_dir(NameVsn),
|
||||
case filelib:ensure_path(ConfigDir) of
|
||||
ok ->
|
||||
ok;
|
||||
{error, Reason} ->
|
||||
?SLOG(warning, #{
|
||||
msg => "failed_to_create_plugin_config_dir",
|
||||
dir => ConfigDir,
|
||||
reason => Reason
|
||||
}),
|
||||
{error, {mkdir_failed, ConfigDir, Reason}}
|
||||
end.
|
||||
|
||||
write_avro_bin(NameVsn, AvroBin) ->
|
||||
|
|
Loading…
Reference in New Issue