From eea2bd617f4f4624fe607b7e9e7e65fd881a4d17 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 1 Sep 2023 09:10:52 +0200 Subject: [PATCH] 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 --- installer/data/mysql/updatedatabase.pl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 06f98e8e61..b8f2babbdd 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -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; -- 2.30.2