Bug 34685

Summary: updatedatabase.pl does not propagate the error code
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: Installation and upgrade (command-line installer)Assignee: Jonathan Druart <jonathan.druart>
Status: RESOLVED FIXED QA Contact: Kyle M Hall <kyle>
Severity: normal    
Priority: P5 - low CC: dcook, fridolin.somers, kyle
Version: unspecified   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.11.00,23.05.04,22.11.10
Bug Depends on:    
Bug Blocks: 34683    
Attachments: Bug 34685: Make updatedatabase.pl propagate the error
Bug 34685: Make updatedatabase.pl propagate the error
Bug 34685: Make updatedatabase.pl propagate the error
Bug 34685: Make updatedatabase.pl propagate the error

Description Jonathan Druart 2023-09-01 07:46:04 UTC
updatedatabase.pl already return 0 even if an error occurred during the upgrade.
Comment 1 Jonathan Druart 2023-09-01 07:51:17 UTC
Created attachment 155057 [details] [review]
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 $?`
Comment 2 Jonathan Druart 2023-09-01 08:00:54 UTC
Created attachment 155060 [details] [review]
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 $?`
Comment 3 David Cook 2023-09-06 00:55:22 UTC
My test plan:
0. vi Koha.pm
Change $VERSION from "23.06.00.016" to "23.06.00.017"
1. vi installer/data/mysql/db_revs/230600017.pl
Added a "die" into the first part of the "up" sub
2a. koha-mysql kohadev
2b. update systempreferences set value = '23.0600016' where variable = 'Version';
3. echo 'flush_all' | nc -q 1 memcached 11211
4. perl ./installer/data/mysql/updatedatabase.pl
Comment 4 David Cook 2023-09-06 00:57:45 UTC
Created attachment 155247 [details] [review]
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>
Comment 5 Kyle M Hall 2023-09-06 13:32:37 UTC
Created attachment 155274 [details] [review]
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>
Comment 6 Tomás Cohen Arazi 2023-09-06 18:11:05 UTC
Pushed to master for 23.11.

Nice work everyone, thanks!
Comment 7 Fridolin Somers 2023-09-08 19:28:04 UTC
Pushed to 23.05.x for 23.05.04
Comment 8 Matt Blenkinsop 2023-09-15 09:51:09 UTC
Nice work everyone!

Pushed to oldstable for 22.11.x