From 9a78b3fa9e25216cf8fbb87a14cb68a1d4bd03b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Wed, 22 Feb 2023 11:01:10 -0500 Subject: [PATCH] lcitool: fix compat with podman 4.4.0 and docker MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The '{{ json . }}' syntax has returned a single JSON document with an array of entries for images historically with podman. Since podman 4.4.0 this now returns a concatenation of JSON documents, one document per image. Our code is not able to parse a concatenation of documents. This was done to fix docker compatibility[1], because {{ json .}} was supposed to be equivalent to {{ . | json }} while podman mistakenly made it equivalent to {{ json }} IOW, we were already broken in terms of docker compat too. Since we want the single document, we need to use plain 'json' or '{{ json }}'. This picks the former since it does not appear we have a need to use any advanced features of the Go template syntax. [1] https://github.com/containers/podman/issues/16436 Signed-off-by: Daniel P. Berrangé --- lcitool/containers/containers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lcitool/containers/containers.py b/lcitool/containers/containers.py index ed79238e..e026c224 100644 --- a/lcitool/containers/containers.py +++ b/lcitool/containers/containers.py @@ -244,9 +244,9 @@ def _images(self): :returns: a string in JSON format containing image details. """ - # podman images --format {{json .}} --filter dangling=false + # podman images --format json --filter dangling=false - cmd_args = ["--format", "{{json .}}", "--filter", "dangling=false"] + cmd_args = ["--format", "json", "--filter", "dangling=false"] cmd = [self.engine, "images"] cmd.extend(cmd_args)