Skip to content

Commit bcc2df7

Browse files
committed
statd: yanger: stop overwriting infix-containers 'command' leaf
The 'command' leaf is config, with a strict pattern that doesn't allow '&', quotes or pipes. Yanger was populating it from podman's full, untruncated container command -- so any container whose entrypoint uses shell metacharacters (e.g. sh -c "... && ...") failed YANG validation. The symptom: every operational read of /infix-containers:containers returns SR_ERR_INTERNAL, which in turn fails the whole get-data on the operational datastore. This breaks case/misc/operational_all and any RESTCONF/NETCONF read that touches containers. This was introduced in 59028c4 ("Fix #1466: 'show container' shows no output"), which added the operational, pattern-less 'cmdline' leaf but left the old 'command' assignment in place. Drop it -- 'cmdline' already carries the full command line, and 'command' belongs to running config. Note: the failure can look intermittent across test runs because podman storage is persistent. It only triggers once a container with a bad-pattern command ends up in 'podman ps -a', including stale or exited leftovers from earlier runs. Signed-off-by: Richard Alpe <richard@bit42.se>
1 parent 2885112 commit bcc2df7

3 files changed

Lines changed: 0 additions & 10 deletions

File tree

src/statd/python/yanger/infix_containers.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,10 +234,6 @@ def container(ps):
234234
if path:
235235
out["cmdline"] = " ".join([path] + args)
236236

237-
cmd = inspect.get("Config", {}).get("Cmd", [])
238-
if cmd:
239-
out["command"] = " ".join(cmd)
240-
241237
net = network(ps, inspect)
242238
if net:
243239
out["network"] = net

test/case/statd/containers/infix-containers.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
"running": true,
1010
"status": "Up About a minute",
1111
"cmdline": "/usr/bin/tini -- /usr/sbin/httpd -f -v",
12-
"command": "/usr/sbin/httpd -f -v",
1312
"network": {
1413
"interface": [
1514
{
@@ -30,7 +29,6 @@
3029
"running": true,
3130
"status": "Up About a minute",
3231
"cmdline": "/usr/bin/tini -- /usr/sbin/httpd -f -v -p 91",
33-
"command": "/usr/sbin/httpd -f -v -p 91",
3432
"network": {
3533
"interface": [
3634
{
@@ -53,7 +51,6 @@
5351
"running": true,
5452
"status": "Up About a minute",
5553
"cmdline": "/usr/bin/tini -- /usr/sbin/nft-helper /etc/nftables.conf",
56-
"command": "/usr/sbin/nft-helper /etc/nftables.conf",
5754
"network": {
5855
"host": true
5956
}

test/case/statd/containers/operational.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,7 +1188,6 @@
11881188
"container": [
11891189
{
11901190
"cmdline": "/usr/bin/tini -- /usr/sbin/httpd -f -v",
1191-
"command": "/usr/sbin/httpd -f -v",
11921191
"id": "78d28082c2e5d494c82aa181c95118ce498e25930ad9e288ba010257ca336378",
11931192
"image": "localhost/curios-httpd-oci-amd64-v24.11.0:latest",
11941193
"image-id": "d6930d60a73be9980f8e19b4b4f63586a6d3492178e20bea962e4e9b8c654033",
@@ -1209,7 +1208,6 @@
12091208
},
12101209
{
12111210
"cmdline": "/usr/bin/tini -- /usr/sbin/httpd -f -v -p 91",
1212-
"command": "/usr/sbin/httpd -f -v -p 91",
12131211
"id": "3451cfceca4eee1091c1dfedece2faee99bc8a729e781799d9c0b4368a31d86d",
12141212
"image": "localhost/curios-httpd-oci-amd64-v24.11.0:latest",
12151213
"image-id": "d6930d60a73be9980f8e19b4b4f63586a6d3492178e20bea962e4e9b8c654033",
@@ -1232,7 +1230,6 @@
12321230
},
12331231
{
12341232
"cmdline": "/usr/bin/tini -- /usr/sbin/nft-helper /etc/nftables.conf",
1235-
"command": "/usr/sbin/nft-helper /etc/nftables.conf",
12361233
"id": "4e7c3daeba15546e7640014b9ee46e389737ed36583e5cb2f8b75a07a82e8523",
12371234
"image": "localhost/curios-nftables-oci-amd64-v24.11.0:latest",
12381235
"image-id": "7a3cc502436250357a6664100a600f306334b4d7203890b85b7ea9b8da6b5665",

0 commit comments

Comments
 (0)