From 954b3d9b506ef8240d2220bd26bb7c40433cf62d Mon Sep 17 00:00:00 2001 From: Benedikt Ziemons Date: Sat, 14 Nov 2020 23:21:41 +0100 Subject: [PATCH] Only use systemd notify when NOTIFY_SOCKET is set --- .idea/vcs.xml | 6 ++++++ main.py | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 .idea/vcs.xml diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/main.py b/main.py index f17a4b6..504d7d3 100644 --- a/main.py +++ b/main.py @@ -54,7 +54,9 @@ class PodKeeper: print(f"Starting pod {self.podname} at {last_check}", file=sys.stderr, flush=True) podman.play.kube(self.podyaml, *self.podnet_args) try: - sdnotify("--ready") + if 'NOTIFY_SOCKET' in os.environ: + sdnotify("--ready") + while not self.stopping.is_set(): self.waiter.wait() self.waiter.clear()