mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-23 01:23:00 +02:00
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:
@@ -22,6 +22,13 @@ module infix-containers {
|
||||
prefix infix-sys;
|
||||
}
|
||||
|
||||
revision 2026-04-20 {
|
||||
description "Add cmdline operational leaf showing the full process command line
|
||||
(entrypoint + args) from 'podman inspect'. Allow environment variable
|
||||
references (dollar sign, braces) in the command override.";
|
||||
reference "internal";
|
||||
}
|
||||
|
||||
revision 2026-02-23 {
|
||||
description "Input validation improvements";
|
||||
reference "internal";
|
||||
@@ -257,10 +264,19 @@ module infix-containers {
|
||||
leaf command {
|
||||
description "Override ENTRYPOINT from image and run command + args.";
|
||||
type string {
|
||||
pattern '[a-zA-Z0-9_./ :=@%^,+-]+';
|
||||
pattern '[a-zA-Z0-9_./ :=@%^,${}()+-]+';
|
||||
}
|
||||
}
|
||||
|
||||
leaf cmdline {
|
||||
description "Full process command line currently executing in the container,
|
||||
combining the entrypoint and its arguments as reported by
|
||||
'podman inspect'. May differ from the configured 'command'
|
||||
override when the image provides its own entrypoint wrapper.";
|
||||
config false;
|
||||
type string;
|
||||
}
|
||||
|
||||
leaf hostname {
|
||||
description "Sets the container host name, available inside the container.
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- sh -*-
|
||||
MODULES=(
|
||||
"infix-interfaces -e containers"
|
||||
"infix-containers@2026-02-23.yang"
|
||||
"infix-containers@2026-04-20.yang"
|
||||
)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
"image-id": "d6930d60a73be9980f8e19b4b4f63586a6d3492178e20bea962e4e9b8c654033",
|
||||
"running": true,
|
||||
"status": "Up About a minute",
|
||||
"cmdline": "/usr/bin/tini -- /usr/sbin/httpd -f -v",
|
||||
"command": "/usr/sbin/httpd -f -v",
|
||||
"network": {
|
||||
"interface": [
|
||||
@@ -28,6 +29,7 @@
|
||||
"image-id": "d6930d60a73be9980f8e19b4b4f63586a6d3492178e20bea962e4e9b8c654033",
|
||||
"running": true,
|
||||
"status": "Up About a minute",
|
||||
"cmdline": "/usr/bin/tini -- /usr/sbin/httpd -f -v -p 91",
|
||||
"command": "/usr/sbin/httpd -f -v -p 91",
|
||||
"network": {
|
||||
"interface": [
|
||||
@@ -50,6 +52,7 @@
|
||||
"image-id": "7a3cc502436250357a6664100a600f306334b4d7203890b85b7ea9b8da6b5665",
|
||||
"running": true,
|
||||
"status": "Up About a minute",
|
||||
"cmdline": "/usr/bin/tini -- /usr/sbin/nft-helper /etc/nftables.conf",
|
||||
"command": "/usr/sbin/nft-helper /etc/nftables.conf",
|
||||
"network": {
|
||||
"host": true
|
||||
|
||||
@@ -1187,6 +1187,7 @@
|
||||
"infix-containers:containers": {
|
||||
"container": [
|
||||
{
|
||||
"cmdline": "/usr/bin/tini -- /usr/sbin/httpd -f -v",
|
||||
"command": "/usr/sbin/httpd -f -v",
|
||||
"id": "78d28082c2e5d494c82aa181c95118ce498e25930ad9e288ba010257ca336378",
|
||||
"image": "localhost/curios-httpd-oci-amd64-v24.11.0:latest",
|
||||
@@ -1207,6 +1208,7 @@
|
||||
"status": "Up About a minute"
|
||||
},
|
||||
{
|
||||
"cmdline": "/usr/bin/tini -- /usr/sbin/httpd -f -v -p 91",
|
||||
"command": "/usr/sbin/httpd -f -v -p 91",
|
||||
"id": "3451cfceca4eee1091c1dfedece2faee99bc8a729e781799d9c0b4368a31d86d",
|
||||
"image": "localhost/curios-httpd-oci-amd64-v24.11.0:latest",
|
||||
@@ -1229,6 +1231,7 @@
|
||||
"status": "Up About a minute"
|
||||
},
|
||||
{
|
||||
"cmdline": "/usr/bin/tini -- /usr/sbin/nft-helper /etc/nftables.conf",
|
||||
"command": "/usr/sbin/nft-helper /etc/nftables.conf",
|
||||
"id": "4e7c3daeba15546e7640014b9ee46e389737ed36583e5cb2f8b75a07a82e8523",
|
||||
"image": "localhost/curios-nftables-oci-amd64-v24.11.0:latest",
|
||||
|
||||
Reference in New Issue
Block a user