Bug 18562

Summary: Add koha-sip script to handle SIP servers for instances
Product: Koha Reporter: Tomás Cohen Arazi <tomascohen>
Component: Command-line UtilitiesAssignee: Tomás Cohen Arazi <tomascohen>
Status: CLOSED FIXED QA Contact: Martin Renvoize <martin.renvoize>
Severity: enhancement    
Priority: P5 - low CC: fridolin.somers, jonathan.druart, kyle, lucas, magnus, martin.renvoize, mirko, nick, pongtawat, robin
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
To ease multi-tenant sites maintenance, several handy scripts were introduced. For handling SIP servers, 3 scripts were introduced: koha-start-sip, koha-stop-sip and koha-enable-sip. This patch introduces a new script, koha-sip, that unifies those actions regarding SIP servers on a per instance base, through the use of option switches.
Version(s) released in:
Bug Depends on:    
Bug Blocks: 18114, 22235, 22396, 22397    
Attachments: Bug 18562: Add koha-sip maintenance script
Bug 18562: Add manpage for koha-sip
Bug 18562: Tab completion in bash
Bug 18562: Add koha-sip maintenance script
Bug 18562: Add manpage for koha-sip
Bug 18562: Tab completion in bash
Bug 18562: Add koha-sip maintenance script
Bug 18562: Add manpage for koha-sip
Bug 18562: Tab completion in bash

Description Tomás Cohen Arazi 2017-05-09 18:05:53 UTC

    
Comment 1 Tomás Cohen Arazi 2019-01-30 12:22:33 UTC
Created attachment 84511 [details] [review]
Bug 18562: Add koha-sip maintenance script

This patch introduces a single script to handle all actions on SIP
servers for Koha instances. It is intended to be a replacement for:

- koha-start-sip
- koha-stop-sip
- koha-enable-sip

It adds a function called is_sip_running to koha-functions.sh.

To test:
- Apply this patch
- Run:
  $ misc4dev/cp_debian_files.pl
  $ sudo koha-sip --enable kohadev
  $ sudo koha-sip --start kohadev
  $ sudo koha-sip --status kohadev
=> SUCCESS: The SIP server is running for kohadev
- Run:
  $ sudo koha-sip --restart --verbose kohadev
  $ sudo koha-sip --status kohadev
=> SUCCESS: The SIP server is running for kohadev
- Run:
  $ sudo koha-sip --stop kohadev
  $ sudo koha-sip --status kohadev
=> SUCCESS: The SIP server is not running for kohadev
- Play with other combinations like enabling an already enabled
instance, etc. Remember you need to remove the
/etc/koha/sites/kohadev/SIPconfig.xml file so it is considered disabled.
- Sign off :-D
Comment 2 Tomás Cohen Arazi 2019-01-30 12:22:40 UTC
Created attachment 84512 [details] [review]
Bug 18562: Add manpage for koha-sip

This patch adds the manpage for koha-sip.

To test:
- Apply this patch
- Run:
  $ kshell
 k$ prove xt/verify-debian-docbook.t
=> SUCCESS: Tests pass!
- Run:
  $ misc4dev/cp_debian_files.pl
  $ man koha-sip
=> SUCCESS: The man page shows correctly.
- Sign off :-D
Comment 3 Tomás Cohen Arazi 2019-01-30 12:22:45 UTC
Created attachment 84513 [details] [review]
Bug 18562: Tab completion in bash

This patch adds the fancy tab completion in bash.

To test:
- Run:
  $ source debian/koha-common.bash-completion
  $ sudo koha-sip <tab>
- Play with all the options
=> SUCCESS: The combinations make sense (e.g. only SIP-enabled instances
  are completed for --start, --stop, --restart, -v and --verbose are not
  offered if the other one is already in there, --enable only applies to
  SIP-disabled instances, etc).
- Sign off :-D
Comment 4 Kyle M Hall 2019-01-30 13:19:09 UTC
Created attachment 84521 [details] [review]
Bug 18562: Add koha-sip maintenance script

This patch introduces a single script to handle all actions on SIP
servers for Koha instances. It is intended to be a replacement for:

- koha-start-sip
- koha-stop-sip
- koha-enable-sip

It adds a function called is_sip_running to koha-functions.sh.

To test:
- Apply this patch
- Run:
  $ misc4dev/cp_debian_files.pl
  $ sudo koha-sip --enable kohadev
  $ sudo koha-sip --start kohadev
  $ sudo koha-sip --status kohadev
=> SUCCESS: The SIP server is running for kohadev
- Run:
  $ sudo koha-sip --restart --verbose kohadev
  $ sudo koha-sip --status kohadev
=> SUCCESS: The SIP server is running for kohadev
- Run:
  $ sudo koha-sip --stop kohadev
  $ sudo koha-sip --status kohadev
=> SUCCESS: The SIP server is not running for kohadev
- Play with other combinations like enabling an already enabled
instance, etc. Remember you need to remove the
/etc/koha/sites/kohadev/SIPconfig.xml file so it is considered disabled.
- Sign off :-D

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 5 Kyle M Hall 2019-01-30 13:19:37 UTC
Created attachment 84522 [details] [review]
Bug 18562: Add manpage for koha-sip

This patch adds the manpage for koha-sip.

To test:
- Apply this patch
- Run:
  $ kshell
 k$ prove xt/verify-debian-docbook.t
=> SUCCESS: Tests pass!
- Run:
  $ misc4dev/cp_debian_files.pl
  $ man koha-sip
=> SUCCESS: The man page shows correctly.
- Sign off :-D

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 6 Kyle M Hall 2019-01-30 13:19:40 UTC
Created attachment 84523 [details] [review]
Bug 18562: Tab completion in bash

This patch adds the fancy tab completion in bash.

To test:
- Run:
  $ source debian/koha-common.bash-completion
  $ sudo koha-sip <tab>
- Play with all the options
=> SUCCESS: The combinations make sense (e.g. only SIP-enabled instances
  are completed for --start, --stop, --restart, -v and --verbose are not
  offered if the other one is already in there, --enable only applies to
  SIP-disabled instances, etc).
- Sign off :-D

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 7 Martin Renvoize 2019-02-11 08:37:08 UTC
Created attachment 84951 [details] [review]
Bug 18562: Add koha-sip maintenance script

This patch introduces a single script to handle all actions on SIP
servers for Koha instances. It is intended to be a replacement for:

- koha-start-sip
- koha-stop-sip
- koha-enable-sip

It adds a function called is_sip_running to koha-functions.sh.

To test:
- Apply this patch
- Run:
  $ misc4dev/cp_debian_files.pl
  $ sudo koha-sip --enable kohadev
  $ sudo koha-sip --start kohadev
  $ sudo koha-sip --status kohadev
=> SUCCESS: The SIP server is running for kohadev
- Run:
  $ sudo koha-sip --restart --verbose kohadev
  $ sudo koha-sip --status kohadev
=> SUCCESS: The SIP server is running for kohadev
- Run:
  $ sudo koha-sip --stop kohadev
  $ sudo koha-sip --status kohadev
=> SUCCESS: The SIP server is not running for kohadev
- Play with other combinations like enabling an already enabled
instance, etc. Remember you need to remove the
/etc/koha/sites/kohadev/SIPconfig.xml file so it is considered disabled.
- Sign off :-D

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 8 Martin Renvoize 2019-02-11 08:37:11 UTC
Created attachment 84952 [details] [review]
Bug 18562: Add manpage for koha-sip

This patch adds the manpage for koha-sip.

To test:
- Apply this patch
- Run:
  $ kshell
 k$ prove xt/verify-debian-docbook.t
=> SUCCESS: Tests pass!
- Run:
  $ misc4dev/cp_debian_files.pl
  $ man koha-sip
=> SUCCESS: The man page shows correctly.
- Sign off :-D

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 9 Martin Renvoize 2019-02-11 08:37:15 UTC
Created attachment 84953 [details] [review]
Bug 18562: Tab completion in bash

This patch adds the fancy tab completion in bash.

To test:
- Run:
  $ source debian/koha-common.bash-completion
  $ sudo koha-sip <tab>
- Play with all the options
=> SUCCESS: The combinations make sense (e.g. only SIP-enabled instances
  are completed for --start, --stop, --restart, -v and --verbose are not
  offered if the other one is already in there, --enable only applies to
  SIP-disabled instances, etc).
- Sign off :-D

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 10 Martin Renvoize 2019-02-11 08:37:45 UTC
Nice complete patch which brings consistency.  Passing QA
Comment 11 Nick Clemens 2019-02-11 18:37:32 UTC
Awesome work all!

Pushed to master for 19.05
Comment 12 Martin Renvoize 2019-02-12 13:06:32 UTC
Pushed to 18.11.x for 18.11.03
Comment 13 Lucas Gass 2019-02-12 22:29:29 UTC
enhancement, wont backport to 18.05.x
Comment 14 Jonathan Druart 2019-02-22 12:39:34 UTC
sudo koha-sip --start --verbose kohadev
[ ok ] Starting Koha Zebra daemon for kohadev:.
Comment 15 Jonathan Druart 2019-02-22 12:40:29 UTC
Also, is that correct?

% sudo koha-sip --restart --verbose kohadev
Stopping SIP server for kohadev:.
Warning: SIP server already running for kohadev:.
Comment 16 Tomás Cohen Arazi 2019-02-22 15:11:30 UTC
(In reply to Jonathan Druart from comment #15)
> Also, is that correct?
> 
> % sudo koha-sip --restart --verbose kohadev
> Stopping SIP server for kohadev:.
> Warning: SIP server already running for kohadev:.

Dealt with on bug 22396. Thanks!
Comment 17 Tomás Cohen Arazi 2019-02-22 15:13:02 UTC
(In reply to Jonathan Druart from comment #14)
> sudo koha-sip --start --verbose kohadev
> [ ok ] Starting Koha Zebra daemon for kohadev:.

Dealt with on bug 22397. Thanks!
Comment 18 Magnus Enger 2019-03-19 08:05:29 UTC
*** Bug 19962 has been marked as a duplicate of this bug. ***