silently catches error in systemd.daemon.notify

our version of systemd installed does not accept
a string as argument for systemd.daemon.notify

anyway, whether systemd notifications are sent or not
should not depend only on the presence of a package,
but should be configurable.

Change-Id: I466d1ed2b969301a287dd532ab4d0743a74045fa
Reviewed-on: https://forge.frm2.tum.de/review/c/secop/frappy/+/31280
Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de>
Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
This commit is contained in:
2023-06-02 14:03:11 +02:00
parent a11b8cf2d1
commit 68d74347c6

View File

@@ -45,6 +45,7 @@ except ImportError:
DaemonContext = None
try:
# pylint: disable=unused-import
import systemd.daemon
except ImportError:
systemd = None
@@ -132,8 +133,12 @@ class Server:
while self._restart:
self._restart = False
try:
if systemd:
# TODO: make systemd notifications configurable
if systemd: # pylint: disable=used-before-assignment
systemd.daemon.notify("STATUS=initializing")
except Exception:
systemd = None # pylint: disable=redefined-outer-name
try:
self._processCfg()
if self._testonly:
return