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:
parent
88fd58dd6c
commit
a1f8f35b70
4
about.pl
4
about.pl
|
|
@ -871,7 +871,6 @@ sub elasticsearch_check {
|
||||||
# fetch the list of available indexes (e.g. plugins, etc)
|
# fetch the list of available indexes (e.g. plugins, etc)
|
||||||
$es_status->{nodes} = $es_conf->{nodes};
|
$es_status->{nodes} = $es_conf->{nodes};
|
||||||
my $es = Search::Elasticsearch->new($es_conf);
|
my $es = Search::Elasticsearch->new($es_conf);
|
||||||
my $es_status->{version} = $es->info->{version}->{number};
|
|
||||||
|
|
||||||
foreach my $index (@indexes) {
|
foreach my $index (@indexes) {
|
||||||
my $index_count;
|
my $index_count;
|
||||||
|
|
@ -910,6 +909,9 @@ sub elasticsearch_check {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
$es_status->{running} = $es_running;
|
$es_status->{running} = $es_running;
|
||||||
|
if ($es_running) {
|
||||||
|
$es_status->{version} = $es->info->{version}->{number};
|
||||||
|
}
|
||||||
|
|
||||||
$template->param(
|
$template->param(
|
||||||
elasticsearch_status => $es_status,
|
elasticsearch_status => $es_status,
|
||||||
|
|
|
||||||
|
|
@ -181,7 +181,7 @@
|
||||||
[% END %]
|
[% END %]
|
||||||
<td class="[% td_class | html %]">
|
<td class="[% td_class | html %]">
|
||||||
<span>Version:</span>
|
<span>Version:</span>
|
||||||
<span>[% elasticsearch_status.version | html %]</span>
|
<span>[% elasticsearch_status.version || t("Unknown") | html %]</span>
|
||||||
|
|
|
|
||||||
<span>Nodes:</span>
|
<span>Nodes:</span>
|
||||||
<span>[% elasticsearch_status.nodes.join(' / ') | html %]</span>
|
<span>[% elasticsearch_status.nodes.join(' / ') | html %]</span>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue