Skip to content

Commit 67101e1

Browse files
committed
Remove unused delete_ip_address()
mainly to improve code coverage
1 parent 00d8bd2 commit 67101e1

File tree

1 file changed

+0
-14
lines changed

1 file changed

+0
-14
lines changed

src/aleph/vm/network/interfaces.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -61,20 +61,6 @@ def add_ip_address(ipr: IPRoute, device_name: str, ip: IPv4Interface | IPv6Inter
6161
logger.error(f"Unknown exception while adding address {ip} to interface {device_name}: {e}")
6262

6363

64-
def delete_ip_address(ipr: IPRoute, device_name: str, ip: IPv4Interface | IPv6Interface):
65-
"""Delete an IP address to the given interface."""
66-
interface_index: list[int] = ipr.link_lookup(ifname=device_name)
67-
if not interface_index:
68-
msg = f"Interface {device_name} does not exist, can't delete address {ip} to it."
69-
raise MissingInterfaceError(msg)
70-
try:
71-
ipr.addr("del", index=interface_index[0], address=str(ip.ip), mask=ip.network.prefixlen)
72-
except NetlinkError as e:
73-
logger.exception(f"Unknown exception while deleting address {ip} to interface {device_name}: {e}")
74-
except OSError as e:
75-
logger.exception(f"Unknown exception while deleting address {ip} to interface {device_name}: {e}")
76-
77-
7864
def set_link_up(ipr: IPRoute, device_name: str):
7965
"""Set the given interface up."""
8066
interface_index: list[int] = ipr.link_lookup(ifname=device_name)

0 commit comments

Comments
 (0)