From 28d0e16303c1abac806b4f8ff9f79489990d124b Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Tue, 20 Feb 2024 17:43:58 +0100 Subject: [PATCH] Devices/Device.py: Fix for broken cleanup() with missing tc tool If no tc utility is present on the agent system, exec_cmd() raises an exception. If uncaught, the previous address flush request will also not complete. The address remaining in place will cause an EEXIST error upon next test run, requiring manual intervention to resolve the situation. Fixes: 49e523d5aef46 ("Slave: Add basic support for tc.") Signed-off-by: Phil Sutter --- lnst/Devices/Device.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lnst/Devices/Device.py b/lnst/Devices/Device.py index b21b8869b..075f9b73b 100644 --- a/lnst/Devices/Device.py +++ b/lnst/Devices/Device.py @@ -422,8 +422,11 @@ def cleanup(self): self.down() self.ip_flush() - self._clear_tc_qdisc() - self._clear_tc_filters() + try: + self._clear_tc_qdisc() + self._clear_tc_filters() + except ExecCmdFail: + pass self.restore_original_data()