From 42ce8c29960dc8d133f8403db31459bae810f8e1 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 16 Aug 2021 11:44:14 +0200 Subject: [PATCH] Bug 25078: Don't process db revs if updatedatabase.pl failed The updatedatebase stops when something wrong happens, we should not continue to process the new DB revs (db_revs dir) in that case. Signed-off-by: Jonathan Druart --- installer/install.pl | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/installer/install.pl b/installer/install.pl index abb3897a94..cffabec3fe 100755 --- a/installer/install.pl +++ b/installer/install.pl @@ -416,10 +416,12 @@ elsif ( $step && $step == 3 ) { or die "Cannot open log file $logfilepath_errors: $!"; @report = <$fh>; close $fh; + my $update_errors; if (@report) { $template->param( update_errors => [ map { { line => $_ } } split( /\n/, join( '', @report ) ) ] ); + $update_errors = 1; $template->param( has_update_errors => 1 ); warn "The following errors were returned while attempting to run the updatedatabase.pl script:\n"; @@ -429,21 +431,22 @@ elsif ( $step && $step == 3 ) { eval { `rm $logfilepath_errors` }; } - my $db_entries = get_db_entries(); - my $report = update( $db_entries ); - my $atomic_update_files = get_atomic_updates; - my $atomic_update_report = run_atomic_updates( $atomic_update_files ); - - $template->param( - success => $report->{success}, - error => $report->{error}, - atomic_updates => { - success => $atomic_update_report->{success}, - error => $atomic_update_report->{error} - } - ); + unless ( $update_errors ) { + my $db_entries = get_db_entries(); + my $report = update( $db_entries ); + my $atomic_update_files = get_atomic_updates; + my $atomic_update_report = run_atomic_updates( $atomic_update_files ); + + $template->param( + success => $report->{success}, + error => $report->{error}, + atomic_updates => { + success => $atomic_update_report->{success}, + error => $atomic_update_report->{error} + } + ); + } - #warn "The following errors were returned while attempting to run the updatedatabase.pl script:\n"; #FIXME restore this $template->param( $op => 1 ); } else { -- 2.39.5