Fix checking and set stopping event directly

This commit is contained in:
Benedikt Ziemons 2020-11-14 23:26:38 +01:00
parent 954b3d9b50
commit b7e5cf97c2
Signed by: ben
GPG key ID: 0F54A7ED232D3319

View file

@ -66,9 +66,10 @@ class PodKeeper:
pod_description = json.loads(podman.pod.inspect(self.podname)) pod_description = json.loads(podman.pod.inspect(self.podname))
for container in pod_description["Containers"]: for container in pod_description["Containers"]:
if container["State"] != "running": if container["State"] != "running":
print(f"Container {container['name']} exited", file=sys.stderr, flush=True) print(f"Container {container['Name']} exited", file=sys.stderr, flush=True)
print(f"Log since last check:\n{podman.logs('--since', last_check.isoformat(), container['name'])}", file=sys.stderr, flush=True) logs = podman.logs('--since', last_check.isoformat(), container['Name'])
self.destroy() print(f"Log since last check:\n{logs}", file=sys.stderr, flush=True)
self.stopping.set()
last_check = new_timestamp last_check = new_timestamp
if self.reloading.is_set(): if self.reloading.is_set():