Tell status to systemd-notify

This commit is contained in:
Benedikt Ziemons 2020-11-18 23:41:14 +01:00
parent 9d0c9b94c2
commit 2834f416c0
Signed by: ben
GPG key ID: 0F54A7ED232D3319

View file

@ -57,7 +57,7 @@ class PodKeeper:
podman.play.kube(self.podyaml, *self.podnet_args) podman.play.kube(self.podyaml, *self.podnet_args)
try: try:
if 'NOTIFY_SOCKET' in os.environ: if 'NOTIFY_SOCKET' in os.environ:
sdnotify("--ready") sdnotify("--ready", f"--pid={os.getpid()}", "--status=\"Monitoring pod...\"")
while not self.stopping.is_set(): while not self.stopping.is_set():
self.waiter.wait() self.waiter.wait()
@ -71,6 +71,8 @@ class PodKeeper:
self.reloading.clear() self.reloading.clear()
self.reload_pod() self.reload_pod()
if 'NOTIFY_SOCKET' in os.environ:
sdnotify("--status=\"Stopping pod\"")
finally: finally:
self.stop_pod() self.stop_pod()