Bug 12856 - koha-disable fails without disabling site
Summary: koha-disable fails without disabling site
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Command-line Utilities (show other bugs)
Version: master
Hardware: All All
: P5 - low blocker (vote)
Assignee: Tomás Cohen Arazi
QA Contact: Testopia
URL:
Keywords:
Depends on: 11404
Blocks:
  Show dependency treegraph
 
Reported: 2014-09-01 13:26 UTC by koha
Modified: 2019-06-27 09:24 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 12856 - koha-disable fails without disabling site (2.94 KB, patch)
2014-10-06 21:05 UTC, Liz Rea
Details | Diff | Splinter Review
Bug 12856 - koha-disable fails without disabling site (2.92 KB, patch)
2014-10-06 21:10 UTC, Liz Rea
Details | Diff | Splinter Review
Bug 12856 - koha-disable fails without disabling site (3.01 KB, patch)
2014-10-08 03:27 UTC, Mason James
Details | Diff | Splinter Review
[PASSED QA] Bug 12856: koha-disable fails without disabling site (2.57 KB, patch)
2014-11-27 14:39 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 koha 2014-09-01 13:26:47 UTC
When running 'koha-disable <instancename>' (eg. koha-disable myinstance) (on a fresh install of koha) I get:

/usr/sbin/koha-disable: 35: [: =: argument expected

From what I can tell the site is never disabled. 

See http://paste.koha-community.org/184 for a paste from running 'bash -x koha-disable".

My guess is that this is caused by a reference to $instancename in the script (that is never set).
Comment 1 Mason James 2014-09-29 05:34:56 UTC
(In reply to koha from comment #0)
> When running 'koha-disable <instancename>' (eg. koha-disable myinstance) (on
> a fresh install of koha) I get:
> 
> /usr/sbin/koha-disable: 35: [: =: argument expected
> 


just a little update...
the new 'shellshock patched' version of bash may have fixed this bug :)

(thanks Liz!)
Comment 2 Mason James 2014-09-29 07:10:24 UTC
(In reply to Mason James from comment #1)
> (In reply to koha from comment #0)
> > When running 'koha-disable <instancename>' (eg. koha-disable myinstance) (on
> > a fresh install of koha) I get:
> > 
> > /usr/sbin/koha-disable: 35: [: =: argument expected
> > 
> 
> 
> just a little update...
> the new 'shellshock patched' version of bash may have fixed this bug :)
> 
> (thanks Liz!)

oops!, Liz was saying that her patched bash still has this bug

some good news, its working for me. :)

i'll add some more info...


root@xen1:~# koha-enable k1
Instance k1 already enabled.
root@xen1:~# bash -x koha-disable  k1
+ set -e
+ '[' 1 -ge 1 ']'
+ restart_apache=no
+ for name in '"$@"'
+ is_instance k1
+ local instancename=k1
+ grep -q -x k1
+ find /etc/koha/sites -mindepth 1 -maxdepth 1 -type d -printf '%f\n'
+ return 0
+ disable_instance k1
+ local instancename=k1
+ is_enabled k1
+ local instancename=k1
+ is_instance k1
+ local instancename=k1
+ grep -q -x k1
+ find /etc/koha/sites -mindepth 1 -maxdepth 1 -type d -printf '%f\n'
+ return 0
+ grep -q '^[[:space:]]*Include /etc/koha/apache-shared-disable.conf' /etc/apache2/sites-available/k1
+ return 0
+ sed -i 's:^\s*#\(\s*Include /etc/koha/apache-shared-disable.conf\)$:\1:' /etc/apache2/sites-available/k1
+ return 0
+ restart_apache=yes
+ '[' yes = yes ']'
+ /etc/init.d/apache2 restart
Restarting web server: apache2 ... waiting .
+ exit 0
root@xen1:~# koha-list --disabled
k1
Comment 3 Mason James 2014-10-06 20:43:29 UTC
> i'll add some more info...

this was run on a debian 7.6 box :)

$ uname -a
Linux xen1 3.2.0-4-amd64 #1 SMP Debian 3.2.60-1+deb7u3 x86_64 GNU/Linux
Comment 4 Mason James 2014-10-06 20:48:11 UTC
(In reply to Mason James from comment #3)
> > i'll add some more info...
> 
> this was run on a debian 7.6 box :)
> 
> $ uname -a
> Linux xen1 3.2.0-4-amd64 #1 SMP Debian 3.2.60-1+deb7u3 x86_64 GNU/Linux

...and some apache info too
# dpkg -l|grep apache
ii  apache2                                        2.2.22-13+deb7u3              amd64        Apache HTTP Server metapackage
Comment 5 Liz Rea 2014-10-06 21:05:15 UTC Comment hidden (obsolete)
Comment 6 Liz Rea 2014-10-06 21:10:14 UTC Comment hidden (obsolete)
Comment 7 Mason James 2014-10-08 03:27:44 UTC Comment hidden (obsolete)
Comment 8 Mason James 2014-10-08 03:36:23 UTC
> Do this for both debian squeeze/wheezy and ubuntu 12.04 and 14.04, if you
> can. I'd like to see a sign off from a debian (sq/wh)eez(e/y) or ubuntu 12
> user, because I could only test reliably on ubuntu 14.04.

tested ok on debian wheezy
Comment 9 Tomás Cohen Arazi 2014-11-27 14:39:20 UTC
Created attachment 33996 [details] [review]
[PASSED QA] Bug 12856: koha-disable fails without disabling site

To test:
Package up a branch with this patch
install that package
create a site - sudo koha-create --create-db testdisable
enable a site - sudo koha-enable testdisable
check it's enabled - sudo koha-list --enabled
* it should show up
disable a site - sudo koha-disable testdisable
Do this for both debian squeeze/wheezy and ubuntu 12.04 and 14.04, if you can. I'd like to see a sign off from a debian (sq/wh)eez(e/y) or ubuntu 12 user, because I could only test reliably on ubuntu 14.04.
* make sure apache restarts and no errors are produced
check it's disabled - sudo koha-list --enabled
* it should not show up
check the site is still there - sudo koha-list
* it should still be there
check that the config file has the Include for disabling uncommented
* the line Include /etc/koha/apache-shared-disable.conf should not have a # in front.
Re-enable the site - sudo koha-enable testdisable
* the line Include /etc/koha/apache-shared-disable.conf should have a # in front.

And the final question - does the site work? All other functions unchanged?

Signed-off-by: Mason James <mtj@kohaaloha.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Works as expected. code reads better too.
Edit: I added a missing space in one line.
Comment 10 Tomás Cohen Arazi 2014-11-27 14:44:37 UTC
Patch pushed to master.

Thanks Liz!

PS: It makes errors rise on instance creation!
Comment 11 Liz Rea 2014-11-27 20:10:24 UTC
Hi Tomas,

Are the errors something I should be concerned about in relation to this problem?

Liz
Comment 12 Tomás Cohen Arazi 2014-11-27 22:08:46 UTC
(In reply to Liz Rea from comment #11)
> Hi Tomas,
> 
> Are the errors something I should be concerned about in relation to this
> problem?

Nope. It only happens if you use --request-db: in the last step it calls koha-disable... but the rest is ok.
Comment 13 Mason James 2015-02-25 10:54:47 UTC
(In reply to Tomás Cohen Arazi from comment #10)
> Patch pushed to master.

Pushed to 3.16.x, patch will be in 3.16.8
Comment 14 Fridolin Somers 2015-04-02 08:58:33 UTC
Depends on Bug 11404 that adds $instancefile