fix: copy cluster-override.conf from old version

This commit is contained in:
某文 2023-04-23 15:43:18 +08:00
parent 6ef032026f
commit 5593e38ed3
2 changed files with 15 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{application, emqx_conf, [
{description, "EMQX configuration management"},
{vsn, "0.1.17"},
{vsn, "0.1.18"},
{registered, []},
{mod, {emqx_conf_app, []}},
{applications, [kernel, stdlib, emqx_ctl]},

View File

@ -175,7 +175,7 @@ copy_override_conf_from_core_node() ->
_ ->
[{ok, Info} | _] = lists:sort(fun conf_sort/2, Ready),
#{node := Node, conf := RawOverrideConf, tnx_id := TnxId} = Info,
HasDeprecatedFile = maps:get(has_deprecated_file, Info, false),
HasDeprecatedFile = has_deprecated_file(Info),
?SLOG(debug, #{
msg => "copy_cluster_conf_from_core_node_success",
node => Node,
@ -227,3 +227,16 @@ sync_data_from_node(Node) ->
?SLOG(emergency, #{node => Node, msg => "sync_data_from_node_failed", reason => Error}),
error(Error)
end.
has_deprecated_file(#{node := Node} = Info) ->
case maps:find(has_deprecated_file, Info) of
{ok, HasDeprecatedFile} ->
HasDeprecatedFile;
error ->
%% The old version don't have emqx_config:has_deprecated_file/0
Timeout = 5000,
{ok, File} = rpc:call(
Node, application, get_env, [emqx, cluster_override_conf_file], Timeout
),
rpc:call(Node, filelib, is_regular, [File], Timeout)
end.