The script misc/migration_tools/remove_unused_authorities.pl will delete all authorities if zebra is not running. Test plan: 1) Shut down zebra: koha-zebra-ctl.sh stop 2) Execute the script: remove_unused_authorities.pl (with -t if you don't want to really delete from your database). 3) Check that the script would have deleted all the authorities (eg: 31449 authorities parsed, 31449 deleted and 0 unchanged because used).
Created attachment 45257 [details] [review] Bug 15188 - remove_unused_authorities.pl exit if all authorities should be deleted
It looks like ZOOM module behaves like connection was established when zebra is not running (No error code, no error message or exception). I have libnet-z3950-zoom-perl 1.26 on debian wheezy. It would be interesting to test with version 1.30 (jessie package) but for wheezy i think the best fix is to ensure that all authorities will not be deleted.
Why don't you just check that the zebra daemon is running?
Same behavior with 1.30
(In reply to Jonathan Druart from comment #3) > Why don't you just check that the zebra daemon is running? Because: - it would depend on system command to get the pid that could not be installed. - the daemon could run on a remote server. - also, it seems that we have the same problem if zebra is running with nothing indexed.
Have a look at about.pl 94 my $errZebraConnection = C4::Context->Zconn("biblioserver",0)->errcode(); This could do the trick correctly.
Created attachment 46018 [details] [review] Bug 15188 - remove_unused_authorities.pl dies if zebra server is not running
(In reply to Jonathan Druart from comment #6) > Have a look at about.pl > 94 my $errZebraConnection = C4::Context->Zconn("biblioserver",0)->errcode(); > > This could do the trick correctly. My apologies
Created attachment 46741 [details] [review] Bug 15188 - Fixes remove_unused_authorities.pl will delete all authorities if zebra is not running Test plan: 1) Shut down zebra: koha-zebra-ctl.sh stop 2) Execute the script: remove_unused_authorities.pl (with -t if you don't want to really delete from your database). 3) Check that the script would have deleted all the authorities (eg: 31449 authorities parsed, 31449 deleted and 0 unchanged because used). 4) Apply patch 5) Run, notice that the script dies because zebra is unavailable Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Created attachment 46849 [details] [review] Bug 15188 - Fixes remove_unused_authorities.pl will delete all authorities if zebra is not running Test plan: 1) Shut down zebra: koha-zebra-ctl.sh stop 2) Execute the script: remove_unused_authorities.pl (with -t if you don't want to really delete from your database). 3) Check that the script would have deleted all the authorities (eg: 31449 authorities parsed, 31449 deleted and 0 unchanged because used). 4) Apply patch 5) Run, notice that the script dies because zebra is unavailable Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Created attachment 46850 [details] [review] Bug 15188: Do not remove unused auths if zebra is not reachable Other conn errors should be checked (wrong user/pwd, etc.) Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Pushed to Master - Should be in the May 2016 release. Thanks!
Patches pushed to 3.22.x, will be in 3.22.3
This patch has been pushed to 3.20.x, will be in 3.20.9.