mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-30 20:43:02 +02:00
statd: allow ethtool rmon counters readout to fail
Ine373398we restored statd suport for checking for faults in yanger at runtime. This in turn broke CLI "show interfaces" support on the little NanoPi R2S because ethtool cannot read counters in JSON format on it. This patch catches the subprocess exception, allowing this particular call to ethtool to fail with empty result. The only difference from beforee373398is that run_json_cmd() will log an error that ethtool failed, for every interface it is called on. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
@@ -726,12 +726,15 @@ def add_ip_addr(ifname, iface_in, iface_out):
|
||||
|
||||
|
||||
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")
|
||||
if len(data) != 1:
|
||||
logger.warning(f"{ifname}: no counters available, skipping.")
|
||||
"""Fetch interface counters from kernel (need new JSON format!)"""
|
||||
cmd = ['ethtool', '--json', '-S', ifname, '--all-groups']
|
||||
try:
|
||||
data = run_json_cmd(cmd, f"ethtool-groups-{ifname}.json")
|
||||
if len(data) != 1:
|
||||
logger.warning("%s: no counters available, skipping.", ifname)
|
||||
return
|
||||
except subprocess.CalledProcessError:
|
||||
# Allow comand to fail, not all NICs support --json yet
|
||||
return
|
||||
|
||||
iface_in = data[0]
|
||||
|
||||
Reference in New Issue
Block a user