Fix #1466: 'show container' shows no output

A container's command line, as reported by podman, may comtain environment
variables, which the current regexp (added in ed4fe58) does not support.

Extend the regexp to allow environment variables and add an operational,
config false, 'cmdline' leaf node to allow any characters to be reported
for the full command line in the operational output.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2026-04-20 13:02:37 +02:00
parent 2603b0ea1b
commit 59028c4800
6 changed files with 33 additions and 6 deletions
+9 -4
View File
@@ -223,16 +223,21 @@ def container(ps):
"status": ps["Status"]
}
# Bonus information, may not be available
if ps["Command"]:
out["command"] = " ".join(ps["Command"])
inspect = podman_inspect(out["name"])
if inspect and isinstance(inspect, list) and len(inspect) > 0:
inspect = inspect[0]
else:
inspect = {}
path = inspect.get("Path", "")
args = inspect.get("Args", [])
if path:
out["cmdline"] = " ".join([path] + args)
cmd = inspect.get("Config", {}).get("Cmd", [])
if cmd:
out["command"] = " ".join(cmd)
net = network(ps, inspect)
if net:
out["network"] = net