diff mbox series

[2/2] oeqa-runtime: avoid crash in run_network_serialdebug for missing netstat

Message ID 20260113085444.15243-2-peter.marko@siemens.com
State New
Headers show
Series [1/2] oeqa-runtime: fix run_network_serialdebug | expand

Commit Message

Peter Marko Jan. 13, 2026, 8:54 a.m. UTC
From: Peter Marko <peter.marko@siemens.com>

If netstat is not installed on the host, the function fails.

Signed-off-by: Peter Marko <peter.marko@siemens.com>
---
 meta/lib/oeqa/runtime/case.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/meta/lib/oeqa/runtime/case.py b/meta/lib/oeqa/runtime/case.py
index 095bcf434a..23796c0cdf 100644
--- a/meta/lib/oeqa/runtime/case.py
+++ b/meta/lib/oeqa/runtime/case.py
@@ -32,7 +32,10 @@  def run_network_serialdebug(target):
     status, output = target.runner.run_serial("ping -c 1 %s" % target.ip)
     print("ping on target for %s: %s %s" % (target.ip, output, status))
     # Have to use a full path for netstat which isn't in HOSTTOOLS
-    subprocess.call(["/usr/bin/netstat", "-tunape"])
-    subprocess.call(["/usr/bin/netstat", "-ei"])
+    try:
+        subprocess.call(["/usr/bin/netstat", "-tunape"])
+        subprocess.call(["/usr/bin/netstat", "-ei"])
+    except (OSError, subprocess.SubprocessError) as e:
+        print("netstat failed: %s" % e)
     subprocess.call(["ps", "-awx"], shell=True)
     print("PID: %s %s" % (str(os.getpid()), time.time()))