Bug 18913 - Allow symbolic link in /etc/koha/sites
Summary: Allow symbolic link in /etc/koha/sites
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Pongtawat
QA Contact: Tomás Cohen Arazi
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-07-09 16:33 UTC by Pongtawat
Modified: 2018-03-23 01:03 UTC (History)
6 users (show)

See Also:
Change sponsored?: Sponsored
Patch complexity: Trivial patch
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:


Attachments
Allow symbolic link in /etc/koha/sites (1.03 KB, patch)
2017-07-09 16:41 UTC, Pongtawat
Details | Diff | Splinter Review
Bug 18913 - Allows symbolic link in /etc/koha/sites (1.07 KB, patch)
2017-10-25 02:01 UTC, M. Tompsett
Details | Diff | Splinter Review
Bug 18913: Allow symbolic link in /etc/koha/sites (1.91 KB, patch)
2018-02-19 13:11 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Pongtawat 2017-07-09 16:33:19 UTC
Currently using a symbolic link to link a Koha site directory inside /etc/koha/sites to somewhere else doesn't work. Koha scripts (e.g koha-list) only look for actual directory there.

There is some use case where allowing symlink there would be convenient, e.g. linking to a site directory tracked with git.
Comment 1 Pongtawat 2017-07-09 16:41:36 UTC
Created attachment 64935 [details] [review]
Allow symbolic link in /etc/koha/sites

Test Plan:

Before patch:
1) Create a Koha site called demo
2) mv /etc/koha/sites/demo /srv/demo
3) ln -s /srv/demo /etc/koha/sites/
4) koha-list will not show demo as one of the site
5) koha-list --enabled will not show demo as one of the site

After patch:
1) Create a Koha site called demo
2) mv /etc/koha/sites/demo /srv/demo
3) ln -s /srv/demo /etc/koha/sites/
4) koha-list will show demo as one of the site
5) koha-list --enabled will show demo as one of the site
Comment 2 Katrin Fischer 2017-10-08 11:21:06 UTC
Please don't forget to assign your bugs to yourself :)
Comment 3 M. Tompsett 2017-10-25 02:00:18 UTC
Had to adapt test plan, because you need to copy the script file into place.

perl /home/vagrant/misc4dev/do_all_you_can_do.pl --instance test --userid admin --password admin

But other than that, seems to work. -L basically says to follow symbolic links, so this doesn't break anything as far as I can tell.
Comment 4 M. Tompsett 2017-10-25 02:01:04 UTC
Created attachment 68511 [details] [review]
Bug 18913 - Allows symbolic link in /etc/koha/sites

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Comment 5 Pongtawat 2017-10-25 03:31:36 UTC
Thanks for signing off.

And sorry that I forgot that the script has to be copied to system location first. BTW, is there a way to test Debian script directly from the git (dev) layout?
Comment 6 Katrin Fischer 2018-02-16 06:04:15 UTC
Should this be targetted for master?
Comment 7 Tomás Cohen Arazi 2018-02-19 13:11:26 UTC
Created attachment 71939 [details] [review]
Bug 18913: Allow symbolic link in /etc/koha/sites

This patch makes the koha-* scripts follow symbolic links when querying for
Koha instances. Without it, it is not possible to define instances outside the
/etc/koha/sites directory,

To test:
- Create a symlink in /etc/koha/sites:
  $ sudo ln -s /tmp /etc/koha/sites/test
- Test the original is_instance function:
  $ . /usr/share/koha/bin/koha-functions.sh
  $ is_instance test && echo success || echo failure
=> FAIL: symlinks are not considered instance names (i.e. failure is printed)
- Apply this patch
- Update the koha-functions.sh file:
  $ perl misc4dev/cp_debian_files.pl
- Test is_instance again:
  $ . /usr/share/koha/bin/koha-functions.sh
  $ is_instance test && echo success || echo failure
=> SUCCESS: symlinks are considered instance names (i.e. success is printed)
- Sign off :-D

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 8 Jonathan Druart 2018-02-19 19:43:50 UTC
Patch pushed to master for 18.05

Congratulations Pongtawat for your first patch in!
Comment 9 Nick Clemens 2018-03-23 01:03:44 UTC
Enhancement, not backported for 17.11