cleanup: fixed issue cleaning up device names with @ in them

This commit is contained in:
Blake Harnden 2023-06-08 11:36:09 -07:00
parent d04f8d69d2
commit 94f070e0ff

View file

@ -61,7 +61,7 @@ def cleanup_sessions() -> None:
def cleanup_interfaces() -> None: def cleanup_interfaces() -> None:
print("cleaning up devices") print("cleaning up devices")
output = subprocess.check_output("ip -o -br link show", shell=True) output = subprocess.check_output("ip -br link show", shell=True)
lines = output.decode().strip().split("\n") lines = output.decode().strip().split("\n")
for line in lines: for line in lines:
values = line.split() values = line.split()
@ -73,6 +73,7 @@ def cleanup_interfaces() -> None:
or name.startswith("b.") or name.startswith("b.")
or name.startswith("ctrl") or name.startswith("ctrl")
): ):
name = name.split("@")[0]
result = subprocess.call(f"ip link delete {name}", shell=True) result = subprocess.call(f"ip link delete {name}", shell=True)
if result: if result:
print(f"failed to remove {name}") print(f"failed to remove {name}")