Bug 24340 - Add ability to disable SIP using koha-sip
Summary: Add ability to disable SIP using koha-sip
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Command-line Utilities (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Liz Rea
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-01-03 17:35 UTC by Liz Rea
Modified: 2020-05-18 14:12 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Who signed the patch off:
Text to go in the release notes:
This enhancement adds --enable and --disable options to the koha-sip Debian package command. Usage: - koha-sip --enable instancename => Enables the Koha SIP server - koha-sip --disable instancename => Disables and stops the Koha SIP server
Version(s) released in:
20.05.00


Attachments
Bug 24340: allow koha-sip --disable inst (4.86 KB, patch)
2020-01-03 17:51 UTC, Liz Rea
Details | Diff | Splinter Review
Bug 24340: allow koha-sip --disable inst (4.89 KB, patch)
2020-01-04 18:57 UTC, David Nind
Details | Diff | Splinter Review
Bug 24340 (follow-up): Warning -> Information (1004 bytes, patch)
2020-01-14 17:08 UTC, Liz Rea
Details | Diff | Splinter Review
Bug 24340 (follow-up): Add documentation to debian/docs/koha-sip.xml (1.42 KB, patch)
2020-01-14 17:13 UTC, Liz Rea
Details | Diff | Splinter Review
Bug 24340: allow koha-sip --disable inst (4.94 KB, patch)
2020-01-15 08:31 UTC, David Nind
Details | Diff | Splinter Review
Bug 24340 (follow-up): Warning -> Information (1.03 KB, patch)
2020-01-15 08:31 UTC, David Nind
Details | Diff | Splinter Review
Bug 24340 (follow-up): Add documentation to debian/docs/koha-sip.xml (1.47 KB, patch)
2020-01-15 08:31 UTC, David Nind
Details | Diff | Splinter Review
Bug 24340: allow koha-sip --disable inst (7.06 KB, patch)
2020-01-31 21:52 UTC, Liz Rea
Details | Diff | Splinter Review
Bug 24340: allow koha-sip --disable inst (7.26 KB, patch)
2020-01-31 22:19 UTC, Liz Rea
Details | Diff | Splinter Review
Bug 24340: allow koha-sip --disable inst (7.31 KB, patch)
2020-02-01 11:20 UTC, David Nind
Details | Diff | Splinter Review
Bug 24340: allow koha-sip --disable inst (7.38 KB, patch)
2020-02-11 16:27 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Liz Rea 2020-01-03 17:35:10 UTC
We ought to be able to disable SIP with koha-sip --disable inst

At minimum, disabling SIP should

- Stop running SIP services for that instance
- back up the latest existent SIPconfig, and remove the SIPconfig.xml from /etc/koha/sites/inst/ so that it can't start.
Comment 1 Liz Rea 2020-01-03 17:51:22 UTC
Created attachment 96797 [details] [review]
Bug 24340: allow koha-sip --disable inst

To test:

- Enable sip for your testing instance
 sudo koha-sip --enable inst
- Start sip for your testing instance
 sudo koha-sip --start inst
- Verify it is running
 ps ax |grep sip -> you should see processes
- Disable sip for your testing intance
 sudo koha-sip --disable inst
- Verify that the following has happened:
 * the SIPconfig.xml file has been moved to SIPconfig.xml.bak
 * SIP is no longer running for your instance - no SIP processes
 * SIP Cannot be started for the instance because of no config.
Comment 2 Liz Rea 2020-01-03 21:41:14 UTC
Another feature that would be neat, but that I probably won't do for this patch, is the ability to re-enable from a backed up config, if it exists. I don't know why someone would want to do that, but we're keeping a backup so why not allow it.
Comment 3 David Nind 2020-01-04 18:57:26 UTC
Created attachment 96813 [details] [review]
Bug 24340: allow koha-sip --disable inst

To test:

- Enable sip for your testing instance
 sudo koha-sip --enable inst
- Start sip for your testing instance
 sudo koha-sip --start inst
- Verify it is running
 ps ax |grep sip -> you should see processes
- Disable sip for your testing intance
 sudo koha-sip --disable inst
- Verify that the following has happened:
 * the SIPconfig.xml file has been moved to SIPconfig.xml.bak
 * SIP is no longer running for your instance - no SIP processes
 * SIP Cannot be started for the instance because of no config.

Signed-off-by: David Nind <david@davidnind.com>
Comment 4 David Nind 2020-01-04 19:01:06 UTC
Hi Liz. I've signed this off, but I think the debian/docs/koha-sip.xml file needs updating so that the option is listed in the man page for the package command.
Comment 5 David Nind 2020-01-04 19:13:27 UTC
Notes for those testing using koha-testing-docker.

After applying the patch the change to the script isn't recognised, and I get an error message when using the disable option: Error: invalid option switch (--disable)

I had to restart the environment (CTRL-C, then kd, then ku to bring up a fresh instance) as restart_all and flush_memcached didn't seem to work to recognise the script change.

koha-testing-docker has SIP enabled by default so before you test you may want to stop SIP (koha-sip --stop kohadev) and delete the /etc/koha/sites/kohadev/SIPconfig.xml file.

Also, on koha-testing-docker the instance name is kohadev.
Comment 6 Liz Rea 2020-01-07 01:49:11 UTC
(In reply to David Nind from comment #4)
> Hi Liz. I've signed this off, but I think the debian/docs/koha-sip.xml file
> needs updating so that the option is listed in the man page for the package
> command.

good point, I'll make a patch for that. :)
Comment 7 Jonathan Druart 2020-01-13 16:24:55 UTC
209         echo "Warning: SIP server disabled for ${name}"

Do we really want to display a warning if what has been asked has been done successfully?
Comment 8 Liz Rea 2020-01-14 17:08:42 UTC
Created attachment 97360 [details] [review]
Bug 24340 (follow-up): Warning -> Information
Comment 9 Liz Rea 2020-01-14 17:13:53 UTC
Created attachment 97361 [details] [review]
Bug 24340 (follow-up): Add documentation to debian/docs/koha-sip.xml
Comment 10 David Nind 2020-01-15 08:31:12 UTC
Created attachment 97379 [details] [review]
Bug 24340: allow koha-sip --disable inst

To test:

- Enable sip for your testing instance
 sudo koha-sip --enable inst
- Start sip for your testing instance
 sudo koha-sip --start inst
- Verify it is running
 ps ax |grep sip -> you should see processes
- Disable sip for your testing intance
 sudo koha-sip --disable inst
- Verify that the following has happened:
 * the SIPconfig.xml file has been moved to SIPconfig.xml.bak
 * SIP is no longer running for your instance - no SIP processes
 * SIP Cannot be started for the instance because of no config.

Signed-off-by: David Nind <david@davidnind.com>
Comment 11 David Nind 2020-01-15 08:31:16 UTC
Created attachment 97380 [details] [review]
Bug 24340 (follow-up): Warning -> Information

Signed-off-by: David Nind <david@davidnind.com>
Comment 12 David Nind 2020-01-15 08:31:20 UTC
Created attachment 97381 [details] [review]
Bug 24340 (follow-up): Add documentation to debian/docs/koha-sip.xml

Signed-off-by: David Nind <david@davidnind.com>
Comment 13 Tomás Cohen Arazi 2020-01-16 11:24:27 UTC
My feeling is we should go the koha-email-enable/disable way, and have a file in /var/lib/koha/<instance>/sip.enabled instead of relaying on the SIPConfig.xml file for making the decision. Touching the config file looks overkill to me. I agree it could be part of enabling, if there is no config. Probably with --force-create-config or similar.
Comment 14 Liz Rea 2020-01-31 21:52:57 UTC
Created attachment 98257 [details] [review]
Bug 24340: allow koha-sip --disable inst

To test:

- Enable sip for your testing instance
 sudo koha-sip --enable inst
- Start sip for your testing instance
 sudo koha-sip --start inst
- Verify it is running
 ps ax |grep sip -> you should see processes
- Disable sip for your testing intance
 sudo koha-sip --disable inst
- Verify that the following has happened:
 * SIP is no longer running for your instance - no SIP processes
 * SIP Cannot be started for the instance because it is not enabled.
Comment 15 Liz Rea 2020-01-31 22:19:58 UTC
Created attachment 98258 [details] [review]
Bug 24340: allow koha-sip --disable inst

To test:

- Enable sip for your testing instance
 sudo koha-sip --enable inst
- Start sip for your testing instance
 sudo koha-sip --start inst
- Verify it is running
 ps ax |grep sip -> you should see processes
- Disable sip for your testing intance
 sudo koha-sip --disable inst
- Verify that the following has happened:
 * SIP is no longer running for your instance - no SIP processes
 * SIP Cannot be started for the instance because it is not enabled.
Comment 16 David Nind 2020-02-01 11:20:05 UTC
Created attachment 98263 [details] [review]
Bug 24340: allow koha-sip --disable inst

To test:

- Enable sip for your testing instance
 sudo koha-sip --enable inst
- Start sip for your testing instance
 sudo koha-sip --start inst
- Verify it is running
 ps ax |grep sip -> you should see processes
- Disable sip for your testing intance
 sudo koha-sip --disable inst
- Verify that the following has happened:
 * SIP is no longer running for your instance - no SIP processes
 * SIP Cannot be started for the instance because it is not enabled.

Signed-off-by: David Nind <david@davidnind.com>
Comment 17 Jonathan Druart 2020-02-05 11:38:07 UTC
Does it make sense to display the "edit ... to configure" part each time?

"Enabling SIP server for kohadev - edit /etc/koha/sites/kohadev/SIPconfig.xml to configure"

I think
"This is the first time SIP has been enabled. Please check the configurations in /etc/koha/sites/${name}/SIPconfig.xml"
is enough.
Comment 18 Liz Rea 2020-02-11 15:47:54 UTC
is it harmful? Just because you know what to do, doesn't mean everyone does, and the reminder can be useful when you don't do it often.

I'm not keen to remove it, but I won't block a follow up doing so.

Cheers,
Liz
Comment 19 Jonathan Druart 2020-02-11 16:27:11 UTC
I think it's confusing to tell "edit to configure" when it is already supposed to be configured. Letting RM to decide.
Comment 20 Jonathan Druart 2020-02-11 16:27:49 UTC
Created attachment 98716 [details] [review]
Bug 24340: allow koha-sip --disable inst

To test:

- Enable sip for your testing instance
 sudo koha-sip --enable inst
- Start sip for your testing instance
 sudo koha-sip --start inst
- Verify it is running
 ps ax |grep sip -> you should see processes
- Disable sip for your testing intance
 sudo koha-sip --disable inst
- Verify that the following has happened:
 * SIP is no longer running for your instance - no SIP processes
 * SIP Cannot be started for the instance because it is not enabled.

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 21 Martin Renvoize 2020-02-11 16:42:35 UTC
I think it's OK having the reminder of where the config file is.. we can certainly revisit it at a future date if we decide it's superflous.
Comment 22 Martin Renvoize 2020-02-12 16:10:04 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 23 Joy Nelson 2020-03-05 00:54:28 UTC
Enhancement not pushed to 19.11.x