Bug 34685: Make updatedatabase.pl propagate the error

updatedatabase.pl already return 0 even if an error occurred during the upgrade.

Test plan:
Adjust a db rev to make it fail and modify the value of the syspref 'version' in DB to
make the db rev run.

Run updatedabase.pl and `echo $?`

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 531fb2c9fd)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 706e1ed092)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
This commit is contained in:
Jonathan Druart 2023-09-01 09:10:52 +02:00 committed by Matt Blenkinsop
parent 378af20dd1
commit 4fe259f19d
1 changed files with 4 additions and 2 deletions

View File

@ -24295,12 +24295,14 @@ unless ( $ENV{HTTP_HOST} ) { # Is that correct?
my $files = get_db_entries;
my $report = update( $files, { force => $force } );
my $error_code = 0;
for my $s ( @{ $report->{success} } ) {
say Encode::encode_utf8(join "\n", @{$s->{output}});
}
for my $e ( @{ $report->{error} } ) {
say Encode::encode_utf8(join "\n", @{$e->{output}});
say Encode::encode_utf8("ERROR - " . $e->{error});
$error_code = 1;
}
my $atomic_update_files = get_atomic_updates;
@ -24311,9 +24313,9 @@ unless ( $ENV{HTTP_HOST} ) { # Is that correct?
for my $e ( @{ $report->{error} } ) {
say Encode::encode_utf8(join "\n", @{$e->{output}});
say Encode::encode_utf8("ERROR - " . $e->{error});
$error_code = 1;
}
exit $error_code;
}
exit;