Skip to content

Commit 4dfa8b6

Browse files
cable_guy: check if interface is valid BEFORE changing it
1 parent c8a57fc commit 4dfa8b6

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

core/services/cable_guy/api/manager.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,12 @@ async def set_configuration(self, interface: NetworkInterface, watchdog_call: bo
105105
watchdog_call: Whether this is a watchdog call
106106
"""
107107
async with self.config_mutex:
108-
if not watchdog_call:
109-
await self.network_handler.cleanup_interface_connections(interface.name)
110108
interfaces = self.get_interfaces()
111109
valid_names = [interface.name for interface in interfaces]
112110
if interface.name not in valid_names:
113111
raise ValueError(f"Invalid interface name ('{interface.name}'). Valid names are: {valid_names}")
114-
112+
if not watchdog_call:
113+
await self.network_handler.cleanup_interface_connections(interface.name)
115114
logger.info(f"Setting configuration for interface '{interface.name}'.")
116115
if interface.addresses:
117116
# bring interface up

0 commit comments

Comments
 (0)