server: fix systemd variable scope

Change 31280 introduced an error where an import was overridden, which
leads python to consider it a local variable, preventing access to the
systemd import. (TODO: a better way to handle the systemd import?)

Fixes: #4732
Change-Id: I5188a8737392bd8befcdfa9af044a21be9af908a
Reviewed-on: https://forge.frm2.tum.de/review/c/secop/frappy/+/31386
Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de>
Reviewed-by: Alexander Zaft <a.zaft@fz-juelich.de>
This commit is contained in:
Alexander Zaft
2023-06-20 14:29:45 +02:00
parent 5727ecbc7f
commit b91905fc04

View File

@@ -130,14 +130,15 @@ class Server:
pass
def run(self):
global systemd # pylint: disable=global-statement
while self._restart:
self._restart = False
try:
# TODO: make systemd notifications configurable
if systemd: # pylint: disable=used-before-assignment
if systemd:
systemd.daemon.notify("STATUS=initializing")
except Exception:
systemd = None # pylint: disable=redefined-outer-name
systemd = None
try:
self._processCfg()
if self._testonly: