statd: allow ethtool --json to fail without breaking operational ds

On boards like the R2S and the VisionFive2 `ethtool --json -S ethX` is
not yet supported.  This patch allows ethtool to fail, with a slightly
better log message, without breaking the operational datastore.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2024-08-08 13:35:27 +02:00
parent 2e27a7112a
commit 435c5ca9b4
2 changed files with 21 additions and 9 deletions
+3 -3
View File
@@ -621,10 +621,10 @@ def add_ethtool_groups(ifname, iface_out):
"""Fetch interface counters from kernel"""
data = run_json_cmd(['ethtool', '--json', '-S', ifname, '--all-groups'],
f"ethtool-groups-{ifname}.json")
f"ethtool-groups-{ifname}.json")
if len(data) != 1:
print("Error: expected ethtool groups output to be array with length 1", file=sys.stderr)
sys.exit(1)
print(f"Error: no counters available for {ifname}, skipping.")
return
iface_in = data[0]