While testing something else, I have created and removed quite a number of instances on the same server. By chance I discovered that removing instances has not removed the instance-specific direcories below /var/lib/koha/, and the permissions on these directories are completely off: $ ls -l /var/lib/koha/ total 44 drwxr-xr-x 4 test-koha test-koha 4096 2012-11-21 15:59 buskfylk drwxr-xr-x 4 norge-koha norge-koha 4096 2012-12-09 21:14 esme drwxr-xr-x 4 test1-koha test1-koha 4096 2012-11-09 14:15 marc21 drwxr-xr-x 4 1005 1005 4096 2012-12-28 13:00 munka21 drwxr-xr-x 4 norge-koha norge-koha 4096 2013-03-05 17:54 mytest drwxr-xr-x 4 usa-koha usa-koha 4096 2013-03-06 11:12 norge drwxr-xr-x 4 usa-koha usa-koha 4096 2012-12-10 18:47 normarc drwxr-xr-x 4 norge-koha norge-koha 4096 2011-12-03 18:13 sksk drwxr-xr-x 4 test-koha test-koha 4096 2012-12-10 08:36 test drwxr-xr-x 4 test1-koha test1-koha 4096 2013-03-05 17:54 test1 drwxr-xr-x 4 usa-koha usa-koha 4096 2013-03-06 13:17 usa The prmissions for test and test1 are OK, the others are not. I created an instance called "norge", then removed it and created it again. As a result of the situation above I now get a permission error when I try to re-index Zebra for this instance, but I still get hits from the previous incarnation of the instance, presumably because the indexes etc are still there.
Hmm. I'm not sure that it should remove user-generated data (perhaps a --purge option would be good for this), and by the same token it probably shouldn't overwrite existing data. However the permissions being wrong is obviously an issue. I think perhaps the correct approach is to ensure the permissions are correct and set a flag to do a full zebra reindex. I'm open to other ideas though, I'm not totally sure what the best approach is. Another option is perhaps to have an existing directory renamed out of the way if koha-create would cause a name conflict. Thoughts on this?
(In reply to Robin Sheat from comment #1) > Hmm. I'm not sure that it should remove user-generated data (perhaps a > --purge option would be good for this) +1 for the purge option. I expected koha-remove to remove »everything« and got a lot of errors for existing register files when doing koha-restore.
(In reply to Mirko Tietgen from comment #2) > +1 for the purge option. I expected koha-remove to remove »everything« and > got a lot of errors for existing register files when doing koha-restore. Then we should really have koha-create/koha-restore understand that these things could happen and to check for them first, doing something appropriately.
*** Bug 10999 has been marked as a duplicate of this bug. ***
Still an issue in 3.18.5. I did a koha-create, then a koha-remove, then a koha-restore. Here's the output of the koha-restore: sudo koha-restore library.sql.gz library.tar.gz ERROR: File exists: /var/lib/koha/library/ ERROR: File exists: /var/lib/koha/library/plugins/ ERROR: File exists: /var/lib/koha/library/biblios/ ERROR: File exists: /var/lib/koha/library/biblios/key/ ERROR: File exists: /var/lib/koha/library/biblios/shadow/ ERROR: File exists: /var/lib/koha/library/biblios/tmp/ ERROR: File exists: /var/lib/koha/library/biblios/register/ ERROR: File exists: /var/lib/koha/library/biblios/register/reci-0.mf ERROR: File exists: /var/lib/koha/library/biblios/register/gmatch-0.mf ERROR: File exists: /var/lib/koha/library/biblios/register/dict-0.mf ERROR: File exists: /var/lib/koha/library/biblios/register/isambB-0.mf ERROR: File exists: /var/lib/koha/library/biblios/register/recdB-0.mf ERROR: File exists: /var/lib/koha/library/biblios/register/isambA-0.mf ERROR: File exists: /var/lib/koha/library/biblios/register/isambD-0.mf ERROR: File exists: /var/lib/koha/library/biblios/register/isambC-0.mf ERROR: File exists: /var/lib/koha/library/biblios/register/sort18-0.mf ERROR: File exists: /var/lib/koha/library/biblios/register/recdA-0.mf ERROR: File exists: /var/lib/koha/library/biblios/register/sort23-0.mf ERROR: File exists: /var/lib/koha/library/authorities/ ERROR: File exists: /var/lib/koha/library/authorities/key/ ERROR: File exists: /var/lib/koha/library/authorities/shadow/ ERROR: File exists: /var/lib/koha/library/authorities/tmp/ ERROR: File exists: /var/lib/koha/library/authorities/register/ ERROR 1396 (HY000) at line 1: Operation DROP USER failed for 'koha_library'@'%' [ ok ] Restarting web server: apache2 ... waiting . I figure koha-remove should remove everything... but if there's no consensus on that one, I'm happy to have a --purge or --force option. It would be nice to be able to completely destroy any trace of an instance afterward.
Created attachment 46648 [details] [review] Bug 9754: koha-remove optionally includes var/lib and var/spool Currently, the files in the folder /var/lib/koha/[instance] and also in /var/spool/koha/[instance] are not removed. This patch adds the option -p|--purge-all to include those two directories when removing files. Note: There was a small bug in the for loop. On the -k line the extra shift statement is one too much. NOTE: Verify that you use the adjusted koha-remove in the test plan and not accidentally an older version of this script. Test plan: [1] Create an instance test. [2] Run koha-remove and verify that /var/lib/koha/test still exists. [3] Create an instance test2. [4] Run koha-remove -k -p and verify that the sql database still exists but the two instance folders in var/lib/koha and var/spool/koha are gone.
Created attachment 46754 [details] [review] Bug 9754: koha-remove optionally includes var/lib and var/spool Currently, the files in the folder /var/lib/koha/[instance] and also in /var/spool/koha/[instance] are not removed. This patch adds the option -p|--purge-all to include those two directories when removing files. Note: There was a small bug in the for loop. On the -k line the extra shift statement is one too much. NOTE: Verify that you use the adjusted koha-remove in the test plan and not accidentally an older version of this script. Test plan: [1] Create an instance test. [2] Run koha-remove and verify that /var/lib/koha/test still exists. [3] Create an instance test2. [4] Run koha-remove -k -p and verify that the sql database still exists but the two instance folders in var/lib/koha and var/spool/koha are gone. Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Created attachment 46855 [details] [review] Bug 9754: koha-remove optionally includes var/lib and var/spool Currently, the files in the folder /var/lib/koha/[instance] and also in /var/spool/koha/[instance] are not removed. This patch adds the option -p|--purge-all to include those two directories when removing files. Note: There was a small bug in the for loop. On the -k line the extra shift statement is one too much. NOTE: Verify that you use the adjusted koha-remove in the test plan and not accidentally an older version of this script. Test plan: [1] Create an instance test. [2] Run koha-remove and verify that /var/lib/koha/test still exists. [3] Create an instance test2. [4] Run koha-remove -k -p and verify that the sql database still exists but the two instance folders in var/lib/koha and var/spool/koha are gone. Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Pushed to Master - Should be in the May 2016 Release. Thanks!
Patch 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.
*** Bug 20835 has been marked as a duplicate of this bug. ***