Bug 40901: (follow-up) Fail loudly when koha-sip is enabled without flag file
The koha-sip@.service unit gates startup on /var/lib/koha/<inst>/sip.enabled, the per-instance "I want SIP on" flag file. `koha-sip --enable` creates that flag in the same call that runs `systemctl enable`; running a bare `systemctl enable koha-sip@<inst>.service` only flips the systemd half, so the unit ends up enabled-but-refusing-to-start. With ConditionPathExists the failure mode is silent and the unit ends up "enabled" at the systemd level but "Active: inactive" (dead) with "Condition: start condition failed" and the journal logs aren't a big help figuring out the problem. This patch replaces the silent skip with a loud failure with a helpful message: ERROR: SIP not enabled for instance <inst>. Use: koha-sip --enable <inst> SIPconfig.xml is gated by AssertPathExists if it's missing the unit fails. Either failure path lands the unit in failed state, surfaced by 'systemctl --failed' Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> 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:
parent
d67d319b89
commit
c82e55a5a5
|
|
@ -3,8 +3,7 @@ Description=Koha SIP server for %i
|
|||
PartOf=koha@%i.target
|
||||
Requires=koha-create-dirs@%i.service
|
||||
After=koha@%i.target
|
||||
ConditionPathExists=/var/lib/koha/%i/sip.enabled
|
||||
ConditionPathExists=/etc/koha/sites/%i/SIPconfig.xml
|
||||
AssertPathExists=/etc/koha/sites/%i/SIPconfig.xml
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
|
|
@ -14,6 +13,7 @@ WorkingDirectory=/var/lib/koha/%i
|
|||
Environment=KOHA_CONF=/etc/koha/sites/%i/koha-conf.xml
|
||||
Environment=KOHA_HOME=/usr/share/koha
|
||||
Environment=PERL5LIB=/usr/share/koha/lib
|
||||
ExecStartPre=+/bin/sh -c 'test -e /var/lib/koha/%i/sip.enabled || { echo "ERROR: SIP not enabled for instance %i. Use: koha-sip --enable %i" >&2; exit 1; }'
|
||||
ExecStart=/usr/bin/perl /usr/share/koha/lib/C4/SIP/SIPServer.pm /etc/koha/sites/%i/SIPconfig.xml
|
||||
Restart=on-failure
|
||||
RestartSec=30s
|
||||
|
|
|
|||
Loading…
Reference in New Issue