fix: match decode plugin config map failed case
This commit is contained in:
parent
3265a5f9b0
commit
874bcd9a8b
|
@ -1235,8 +1235,7 @@ ensure_config_map(NameVsn) ->
|
||||||
{ok, ConfigJsonMap} ->
|
{ok, ConfigJsonMap} ->
|
||||||
case with_plugin_avsc(NameVsn) of
|
case with_plugin_avsc(NameVsn) of
|
||||||
true ->
|
true ->
|
||||||
{ok, AvroValue} = decode_plugin_config_map(NameVsn, ConfigJsonMap),
|
do_ensure_config_map(NameVsn, ConfigJsonMap);
|
||||||
put_config(NameVsn, ConfigJsonMap, AvroValue);
|
|
||||||
false ->
|
false ->
|
||||||
put_config(NameVsn, ConfigJsonMap, ?plugin_without_config_schema)
|
put_config(NameVsn, ConfigJsonMap, ?plugin_without_config_schema)
|
||||||
end;
|
end;
|
||||||
|
@ -1245,6 +1244,19 @@ ensure_config_map(NameVsn) ->
|
||||||
ok
|
ok
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
do_ensure_config_map(NameVsn, ConfigJsonMap) ->
|
||||||
|
case decode_plugin_config_map(NameVsn, ConfigJsonMap) of
|
||||||
|
{ok, AvroValue} ->
|
||||||
|
put_config(NameVsn, ConfigJsonMap, AvroValue);
|
||||||
|
{error, Reason} ->
|
||||||
|
?SLOG(error, #{
|
||||||
|
msg => "plugin_config_validation_failed",
|
||||||
|
name_vsn => NameVsn,
|
||||||
|
reason => Reason
|
||||||
|
}),
|
||||||
|
ok
|
||||||
|
end.
|
||||||
|
|
||||||
%% @private Backup the current config to a file with a timestamp suffix and
|
%% @private Backup the current config to a file with a timestamp suffix and
|
||||||
%% then save the new config to the config file.
|
%% then save the new config to the config file.
|
||||||
backup_and_write_hocon_bin(NameVsn, HoconBin) ->
|
backup_and_write_hocon_bin(NameVsn, HoconBin) ->
|
||||||
|
|
Loading…
Reference in New Issue