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