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 <devj2311@gmail.com>
Co-authored-by: Antigravity <noreply@google.com>
Co-authored-by: Paige Patton <64206430+paigerube14@users.noreply.github.com>
This commit is contained in:
Dev jaiswal
2026-07-30 11:07:54 -04:00
committed by GitHub
co-authored by Antigravity Paige Patton
parent 1bec1f9051
commit 152c5dfba5
@@ -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: