Use inspect command's stdout for json.loads

This commit is contained in:
Benedikt Ziemons 2020-11-14 23:35:22 +01:00
parent 3715eae575
commit fafa2dc47d
Signed by: ben
GPG key ID: 0F54A7ED232D3319

View file

@ -66,7 +66,8 @@ class PodKeeper:
if self.checking.is_set(): if self.checking.is_set():
self.checking.clear() self.checking.clear()
new_timestamp = datetime.utcnow() new_timestamp = datetime.utcnow()
pod_description = json.loads(podman.pod.inspect(self.podname)) inspect_command = podman.pod.inspect(self.podname)
pod_description = json.loads(inspect_command.stdout)
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)