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
{ok, []} ->
{ok, "Not updated: "++ModuleNameString};
{ok, [{ModuleName, _}]} ->
{ok, [ModuleName]} ->
{ok, "Updated: "++ModuleNameString};
{error, Reason} -> {error, Reason}
end.

View File

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