Bug 42453: Prevent 500 on the about page if elastic is not runing

If the elastic countainer is stopped, the about page crashes with a 500
"No nodes are available"

Test plan:
Startup ktd with `--search-engine es8`
Go to the about page
Notice that the "Elasticsearch" line contains the version and "running"
Stop the es container: `docker start koha-es-1`
Refresh the about page
=> Without this patch you get the 500
=> With this patch applied the page is rendered with:
"Version: Unkown" and "Status: not running"

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
Jonathan Druart 2026-05-04 13:48:18 +02:00 committed by Pedro Amorim
parent 88fd58dd6c
commit a1f8f35b70
No known key found for this signature in database
GPG Key ID: 06B75BA7F3894D55
2 changed files with 4 additions and 2 deletions

View File

@ -871,7 +871,6 @@ sub elasticsearch_check {
# fetch the list of available indexes (e.g. plugins, etc)
$es_status->{nodes} = $es_conf->{nodes};
my $es = Search::Elasticsearch->new($es_conf);
my $es_status->{version} = $es->info->{version}->{number};
foreach my $index (@indexes) {
my $index_count;
@ -910,6 +909,9 @@ sub elasticsearch_check {
};
}
$es_status->{running} = $es_running;
if ($es_running) {
$es_status->{version} = $es->info->{version}->{number};
}
$template->param(
elasticsearch_status => $es_status,

View File

@ -181,7 +181,7 @@
[% END %]
<td class="[% td_class | html %]">
<span>Version:</span>
<span>[% elasticsearch_status.version | html %]</span>
<span>[% elasticsearch_status.version || t("Unknown") | html %]</span>
|
<span>Nodes:</span>
<span>[% elasticsearch_status.nodes.join(' / ') | html %]</span>