fix: dialyzer problem for community edition
This commit is contained in:
parent
6c6c2e0cff
commit
2d05e3a975
|
@ -432,11 +432,10 @@ create_dry_run_helper(BridgeType, ConnectorRawConf, BridgeV2RawConf) ->
|
||||||
create_dry_run(Type, Conf0) ->
|
create_dry_run(Type, Conf0) ->
|
||||||
Conf1 = maps:without([<<"name">>], Conf0),
|
Conf1 = maps:without([<<"name">>], Conf0),
|
||||||
TypeBin = bin(Type),
|
TypeBin = bin(Type),
|
||||||
TypeAtom = binary_to_existing_atom(TypeBin),
|
|
||||||
RawConf = #{<<"bridges_v2">> => #{TypeBin => #{<<"temp_name">> => Conf1}}},
|
RawConf = #{<<"bridges_v2">> => #{TypeBin => #{<<"temp_name">> => Conf1}}},
|
||||||
%% Check config
|
%% Check config
|
||||||
try
|
try
|
||||||
#{bridges_v2 := #{TypeAtom := #{temp_name := _Conf}}} =
|
_ =
|
||||||
hocon_tconf:check_plain(
|
hocon_tconf:check_plain(
|
||||||
emqx_bridge_v2_schema,
|
emqx_bridge_v2_schema,
|
||||||
RawConf,
|
RawConf,
|
||||||
|
|
|
@ -109,8 +109,13 @@ tags() ->
|
||||||
|
|
||||||
roots() ->
|
roots() ->
|
||||||
case fields(bridges_v2) of
|
case fields(bridges_v2) of
|
||||||
[] -> [];
|
[] ->
|
||||||
_ -> [{bridges_v2, ?HOCON(?R_REF(bridges_v2), #{importance => ?IMPORTANCE_LOW})}]
|
[
|
||||||
|
{bridges_v2,
|
||||||
|
?HOCON(hoconsc:map(name, typerefl:map()), #{importance => ?IMPORTANCE_LOW})}
|
||||||
|
];
|
||||||
|
_ ->
|
||||||
|
[{bridges_v2, ?HOCON(?R_REF(bridges_v2), #{importance => ?IMPORTANCE_LOW})}]
|
||||||
end.
|
end.
|
||||||
|
|
||||||
fields(bridges_v2) ->
|
fields(bridges_v2) ->
|
||||||
|
|
|
@ -263,12 +263,13 @@ create_dry_run(Type, Conf0, Callback) ->
|
||||||
Conf1 = maps:without([<<"name">>], Conf0),
|
Conf1 = maps:without([<<"name">>], Conf0),
|
||||||
RawConf = #{<<"connectors">> => #{TypeBin => #{<<"temp_name">> => Conf1}}},
|
RawConf = #{<<"connectors">> => #{TypeBin => #{<<"temp_name">> => Conf1}}},
|
||||||
try
|
try
|
||||||
#{connectors := #{TypeAtom := #{temp_name := Conf}}} =
|
CheckedConf =
|
||||||
hocon_tconf:check_plain(
|
hocon_tconf:check_plain(
|
||||||
emqx_connector_schema,
|
emqx_connector_schema,
|
||||||
RawConf,
|
RawConf,
|
||||||
#{atom_key => true, required => false}
|
#{atom_key => true, required => false}
|
||||||
),
|
),
|
||||||
|
Conf = get_temp_conf(TypeAtom, CheckedConf),
|
||||||
case emqx_connector_ssl:convert_certs(TmpPath, Conf) of
|
case emqx_connector_ssl:convert_certs(TmpPath, Conf) of
|
||||||
{error, Reason} ->
|
{error, Reason} ->
|
||||||
{error, Reason};
|
{error, Reason};
|
||||||
|
@ -286,6 +287,14 @@ create_dry_run(Type, Conf0, Callback) ->
|
||||||
_ = file:del_dir_r(emqx_tls_lib:pem_dir(TmpPath))
|
_ = file:del_dir_r(emqx_tls_lib:pem_dir(TmpPath))
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
get_temp_conf(TypeAtom, CheckedConf) ->
|
||||||
|
case CheckedConf of
|
||||||
|
#{connectors := #{TypeAtom := #{temp_name := Conf}}} ->
|
||||||
|
Conf;
|
||||||
|
#{connectors := #{TypeAtom := #{<<"temp_name">> := Conf}}} ->
|
||||||
|
Conf
|
||||||
|
end.
|
||||||
|
|
||||||
remove(ConnectorId) ->
|
remove(ConnectorId) ->
|
||||||
{ConnectorType, ConnectorName} = parse_connector_id(ConnectorId),
|
{ConnectorType, ConnectorName} = parse_connector_id(ConnectorId),
|
||||||
remove(ConnectorType, ConnectorName, #{}, #{}).
|
remove(ConnectorType, ConnectorName, #{}, #{}).
|
||||||
|
|
|
@ -258,8 +258,13 @@ tags() ->
|
||||||
|
|
||||||
roots() ->
|
roots() ->
|
||||||
case fields(connectors) of
|
case fields(connectors) of
|
||||||
[] -> [];
|
[] ->
|
||||||
_ -> [{connectors, ?HOCON(?R_REF(connectors), #{importance => ?IMPORTANCE_LOW})}]
|
[
|
||||||
|
{connectors,
|
||||||
|
?HOCON(hoconsc:map(name, typerefl:map()), #{importance => ?IMPORTANCE_LOW})}
|
||||||
|
];
|
||||||
|
_ ->
|
||||||
|
[{connectors, ?HOCON(?R_REF(connectors), #{importance => ?IMPORTANCE_LOW})}]
|
||||||
end.
|
end.
|
||||||
|
|
||||||
fields(connectors) ->
|
fields(connectors) ->
|
||||||
|
|
Loading…
Reference in New Issue