Bug 40901: (QA follow-up) koha-disable must disable units even when stopped

On systemd, koha-disable gated both --stop and --disable behind
is_*_running checks (systemctl is-active).  A service that was enabled
but not currently active (e.g. stopped for maintenance) was therefore
never disabled, leaving its unit enabled and able to restart on the next
boot — so the instance was never truly disabled.

Separate the concerns: keep the is_*_running guard around --stop (so we
don't try to stop an already-stopped service), but call --disable
unconditionally for plack, zebra, indexer, and es-indexer.  The disable
call is idempotent on both systemd and SysV, so calling it on an already-
disabled unit is safe.

SIP was already handled correctly (using is_sip_enabled).  Worker units
already used || true so were unaffected.

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
Martin Renvoize 2026-05-21 17:48:33 +01:00 committed by Pedro Amorim
parent 3644a8407f
commit 53ebfcb8c5
No known key found for this signature in database
GPG Key ID: 06B75BA7F3894D55
1 changed files with 4 additions and 4 deletions

View File

@ -69,20 +69,20 @@ do
fi
if is_plack_running $name; then
koha-plack --stop $name
koha-plack --disable $name
fi
koha-plack --disable $name
if is_zebra_running $name; then
koha-zebra --stop $name
koha-zebra --disable $name
fi
koha-zebra --disable $name
if is_indexer_running $name; then
koha-indexer --stop $name
koha-indexer --disable $name
fi
koha-indexer --disable $name
if is_es_indexer_running $name; then
koha-es-indexer --stop $name
koha-es-indexer --disable $name
fi
koha-es-indexer --disable $name
koha-worker --all-queues --stop $name || /bin/true
koha-worker --all-queues --disable $name || /bin/true
elif [ "$RET" = 2 ]; then