fix: return value of post_config_update

This commit is contained in:
Shawn 2022-04-27 11:58:41 +08:00
parent 94e24c2621
commit 318d0df419
2 changed files with 6 additions and 5 deletions

View File

@ -48,12 +48,13 @@ pre_config_update(Path, Conf, _OldConfig) when is_map(Conf) ->
-dialyzer([{nowarn_function, [post_config_update/5]}, error_handling]). -dialyzer([{nowarn_function, [post_config_update/5]}, error_handling]).
post_config_update([connectors, Type, Name] = Path, '$remove', _, OldConf, _AppEnvs) -> post_config_update([connectors, Type, Name] = Path, '$remove', _, OldConf, _AppEnvs) ->
ConnId = connector_id(Type, Name), ConnId = connector_id(Type, Name),
try foreach_linked_bridges(ConnId, fun(#{type := BType, name := BName}) -> try
foreach_linked_bridges(ConnId, fun(#{type := BType, name := BName}) ->
throw({dependency_bridges_exist, emqx_bridge:bridge_id(BType, BName)}) throw({dependency_bridges_exist, emqx_bridge:bridge_id(BType, BName)})
end) end),
_ = emqx_connector_ssl:clear_certs(filename:join(Path), OldConf)
catch throw:Error -> {error, Error} catch throw:Error -> {error, Error}
end, end;
_ = emqx_connector_ssl:clear_certs(filename:join(Path), OldConf);
post_config_update([connectors, Type, Name], _Req, NewConf, OldConf, _AppEnvs) -> post_config_update([connectors, Type, Name], _Req, NewConf, OldConf, _AppEnvs) ->
ConnId = connector_id(Type, Name), ConnId = connector_id(Type, Name),
foreach_linked_bridges(ConnId, foreach_linked_bridges(ConnId,

View File

@ -47,4 +47,4 @@ map_get_oneof([Key | Keys], Map, Default) ->
map_get_oneof(Keys, Map, Default); map_get_oneof(Keys, Map, Default);
{ok, Value} -> {ok, Value} ->
Value Value
end. end.