Only use systemd notify when NOTIFY_SOCKET is set

This commit is contained in:
Benedikt Ziemons 2020-11-14 23:21:41 +01:00
parent cd06cc445e
commit 954b3d9b50
Signed by: ben
GPG key ID: 0F54A7ED232D3319
2 changed files with 9 additions and 1 deletions

6
.idea/vcs.xml Normal file
View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View file

@ -54,7 +54,9 @@ class PodKeeper:
print(f"Starting pod {self.podname} at {last_check}", file=sys.stderr, flush=True) print(f"Starting pod {self.podname} at {last_check}", file=sys.stderr, flush=True)
podman.play.kube(self.podyaml, *self.podnet_args) podman.play.kube(self.podyaml, *self.podnet_args)
try: try:
sdnotify("--ready") if 'NOTIFY_SOCKET' in os.environ:
sdnotify("--ready")
while not self.stopping.is_set(): while not self.stopping.is_set():
self.waiter.wait() self.waiter.wait()
self.waiter.clear() self.waiter.clear()