| Summary: | Fix output of koha-plack --restart | ||
|---|---|---|---|
| Product: | Koha | Reporter: | Magnus Enger <magnus> |
| Component: | Packaging | Assignee: | Magnus Enger <magnus> |
| Status: | CLOSED FIXED | QA Contact: | Marcel de Rooy <m.de.rooy> |
| Severity: | minor | ||
| Priority: | P5 - low | CC: | m.de.rooy, mirko |
| Version: | Main | ||
| Hardware: | All | ||
| OS: | All | ||
| GIT URL: | Initiative type: | --- | |
| Sponsorship status: | --- | Crowdfunding goal: | 0 |
| Patch complexity: | Trivial patch | Documentation contact: | |
| Documentation submission: | Text to go in the release notes: | ||
| Version(s) released in: |
19.11.00
|
Circulation function: | |
| Attachments: |
Bug 23700 - Fix output of koha-plack --restart
Very nicely aligned now. Bug 23700 - Fix output of koha-plack --restart |
||
|
Description
Magnus Enger
2019-09-30 12:27:15 UTC
It looks like problem is here:
166 log_daemon_msg "Restarting Plack daemon for ${instancename}"
167
168 if stop_plack $instancename && start_plack $instancename; then
169 log_end_msg 0
170 else
171 log_end_msg 1
172 fi
We call log_daemon_msg on line 166, then we call the corresponding log_end_msg on lines 169 or 171. But in between we call stop_plack and start_plack, which do their own output through log_daemon_msg/log_end_msg, causing the out of line output.
I can see a couple of solutions to this:
1. Call log_daemon_msg inside the if:
if stop_plack $instancename && start_plack $instancename; then
log_daemon_msg "Restarted Plack daemon for ${instancename}"
log_end_msg 0
else
log_daemon_msg "Could not restart Plack daemon for ${instancename}"
log_end_msg 1
fi
This gives output like this:
$ sudo koha-plack --restart kohadev
[ ok ] Stopping Plack daemon for kohadev:.
[ ok ] Starting Plack daemon for kohadev:.
[ ok ] Restarted Plack daemon for kohadev:.
2. Don't call log_daemon_msg at all:
stop_plack $instancename && start_plack $instancename
This gives us:
$ sudo koha-plack --restart kohadev
[ ok ] Stopping Plack daemon for kohadev:.
[ ok ] Starting Plack daemon for kohadev:.
stop_plack and start_plack will each tell us what they do and if they succeed or not, so do we really need that third line?
I will submit a patch for the second solution, but I'm happy to make a patch for the first solution, if that is the preferred way.
Created attachment 93244 [details] [review] Bug 23700 - Fix output of koha-plack --restart To test: - Run "sudo koha-plack restart kohadev" and verify the output is out of line. - Apply the patch - If you are on e.g. kohadevbox you need to copy koha-plack to /usr/sbin/ thus: sudo cp debian/scripts/koha-plack /usr/sbin/koha-plack - Run "sudo koha-plack restart kohadev" again and check that you get two lines of output, nicely aligned with the "OK" inside the square brackets. Created attachment 93344 [details] [review] Very nicely aligned now. Bug 23700 - Fix output of koha-plack --restart To test: - Run "sudo koha-plack restart kohadev" and verify the output is out of line. - Apply the patch - If you are on e.g. kohadevbox you need to copy koha-plack to /usr/sbin/ thus: sudo cp debian/scripts/koha-plack /usr/sbin/koha-plack - Run "sudo koha-plack restart kohadev" again and check that you get two lines of output, nicely aligned with the "OK" inside the square brackets. Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com> Created attachment 94409 [details] [review] Bug 23700 - Fix output of koha-plack --restart To test: - Run "sudo koha-plack restart kohadev" and verify the output is out of line. - Apply the patch - If you are on e.g. kohadevbox you need to copy koha-plack to /usr/sbin/ thus: sudo cp debian/scripts/koha-plack /usr/sbin/koha-plack - Run "sudo koha-plack restart kohadev" again and check that you get two lines of output, nicely aligned with the "OK" inside the square brackets. Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Nice work! Pushed to master for 19.11.00 |