From 152c5dfba52c00d158c7c8e4261c6e639b2e65b6 Mon Sep 17 00:00:00 2001 From: Dev jaiswal Date: Thu, 30 Jul 2026 20:37:54 +0530 Subject: [PATCH] fix(network_chaos_ng): remove unreachable duplicate get_vmi_tap_interface (#1460) utils.py contained two definitions of get_vmi_tap_interface. Python's name-binding semantics means the second definition (added the following day) silently shadows the first; all callers already executed the second implementation. The first definition is unreachable dead code. Remove it to reduce reader confusion and simplify future maintenance. No behavioral change: call sites in vmi_network_chaos.py and vmi_network_filter.py continue to resolve to the same implementation they have always used. Signed-off-by: cynox-66 Co-authored-by: Antigravity Co-authored-by: Paige Patton <64206430+paigerube14@users.noreply.github.com> --- .../network_chaos_ng/modules/utils.py | 23 ------------------- 1 file changed, 23 deletions(-) diff --git a/krkn/scenario_plugins/network_chaos_ng/modules/utils.py b/krkn/scenario_plugins/network_chaos_ng/modules/utils.py index a2511aca..63ce7963 100644 --- a/krkn/scenario_plugins/network_chaos_ng/modules/utils.py +++ b/krkn/scenario_plugins/network_chaos_ng/modules/utils.py @@ -140,29 +140,6 @@ def find_virt_launcher_netns_pid( return None -def get_vmi_tap_interface( - chaos_pod_name: str, - namespace: str, - netns_pid: str, - kubecli: KrknKubernetes, -) -> Optional[str]: - """Return the name of the tap device inside the virt-launcher netns.""" - result = kubecli.exec_cmd_in_pod( - [f"nsenter --target {netns_pid} --net -- ip -o link show type tun"], - chaos_pod_name, - namespace, - ) - if not result: - return None - for line in result.splitlines(): - parts = line.split(":") - if len(parts) >= 2: - iface = parts[1].strip().split("@")[0].strip() - if iface.startswith("tap"): - return iface - return None - - def get_vmi_tap_interface( chaos_pod_name: str, namespace: str, pid: str, kubecli: KrknKubernetes ) -> str: