25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-20 17:27:00 +01:00

Fix 'update' command output

So far, ejabberd_update:update/0 returned the return value of
release_handler_1:eval_script/1.  That function returns the list of
updated but unpurged modules, i.e., modules where one or more processes
are still running an old version of the code.  Since commit
5a34020d23, the ejabberd 'update' command
assumes that value to be the list of updated modules instead.  As
that seems more useful, modify ejabberd_update:update/0 accordingly.
This fixes the 'update' command output.
This commit is contained in:
Holger Weiss 2024-09-14 21:54:01 +02:00
parent 3469a51f58
commit 3d9a5a1635
2 changed files with 22 additions and 14 deletions

View File

@ -746,7 +746,7 @@ update_module(ModuleNameString) ->
case ejabberd_update:update([ModuleName]) of case ejabberd_update:update([ModuleName]) of
{ok, []} -> {ok, []} ->
{ok, "Not updated: "++ModuleNameString}; {ok, "Not updated: "++ModuleNameString};
{ok, [{ModuleName, _}]} -> {ok, [ModuleName]} ->
{ok, "Updated: "++ModuleNameString}; {ok, "Updated: "++ModuleNameString};
{error, Reason} -> {error, Reason} {error, Reason} -> {error, Reason}
end. end.

View File

@ -38,13 +38,17 @@
%% Update all the modified modules %% Update all the modified modules
update() -> update() ->
case update_info() of case update_info() of
{ok, Dir, _UpdatedBeams, _Script, LowLevelScript, _Check} -> {ok, Dir, UpdatedBeams, _Script, LowLevelScript, _Check} ->
Eval = case eval_script(
eval_script( LowLevelScript, [],
LowLevelScript, [], [{ejabberd, "", filename:join(Dir, "..")}]) of
[{ejabberd, "", filename:join(Dir, "..")}]), {ok, _} ->
?DEBUG("Eval: ~p~n", [Eval]), ?DEBUG("Updated: ~p~n", [UpdatedBeams]),
Eval; {ok, UpdatedBeams};
Eval ->
?DEBUG("Eval: ~p~n", [Eval]),
Eval
end;
{error, Reason} -> {error, Reason} ->
{error, Reason} {error, Reason}
end. end.
@ -56,12 +60,16 @@ update(ModulesToUpdate) ->
UpdatedBeamsNow = UpdatedBeamsNow =
[A || A <- UpdatedBeamsAll, B <- ModulesToUpdate, A == B], [A || A <- UpdatedBeamsAll, B <- ModulesToUpdate, A == B],
{_, LowLevelScript, _} = build_script(Dir, UpdatedBeamsNow), {_, LowLevelScript, _} = build_script(Dir, UpdatedBeamsNow),
Eval = case eval_script(
eval_script( LowLevelScript, [],
LowLevelScript, [], [{ejabberd, "", filename:join(Dir, "..")}]) of
[{ejabberd, "", filename:join(Dir, "..")}]), {ok, _} ->
?DEBUG("Eval: ~p~n", [Eval]), ?DEBUG("Updated: ~p~n", [UpdatedBeamsNow]),
Eval; {ok, UpdatedBeamsNow};
Eval ->
?DEBUG("Eval: ~p~n", [Eval]),
Eval
end;
{error, Reason} -> {error, Reason} ->
{error, Reason} {error, Reason}
end. end.