Pep8
This commit is contained in:
parent
06a5a758a3
commit
58fa7d1ee6
19 changed files with 567 additions and 377 deletions
|
|
@ -35,7 +35,10 @@ class IPService:
|
|||
clients = self.arp_scanner.scan_network()
|
||||
new_ip = args["ipv4_updates"]["ipv4.address-data"][0]["address"]
|
||||
if any(client["ip"] == new_ip for client in clients):
|
||||
return {"available": False, "message": f"IP address {new_ip} уже занят."}
|
||||
return {
|
||||
"available": False,
|
||||
"message": f"IP address {new_ip} уже занят."
|
||||
}
|
||||
return {
|
||||
"available": True,
|
||||
"message": "Network profile settings are available for use.",
|
||||
|
|
@ -46,7 +49,8 @@ class IPService:
|
|||
self._reset_bus()
|
||||
nm = NetworkManager()
|
||||
settings = NetworkManagerSettings()
|
||||
connection_paths = await settings.get_connections_by_id(args["connection_id"])
|
||||
connection_paths = await settings.get_connections_by_id(
|
||||
args["connection_id"])
|
||||
|
||||
if not connection_paths:
|
||||
raise ValueError(f"Подключение {args['connection_id']} не найдено")
|
||||
|
|
@ -73,10 +77,10 @@ class IPService:
|
|||
if await device.interface == interface_name:
|
||||
await device.disconnect()
|
||||
print(f"Отключён от {interface_name}")
|
||||
await nm.activate_connection(
|
||||
connection=connection_paths[0], device=device_path
|
||||
)
|
||||
await nm.activate_connection(connection=connection_paths[0],
|
||||
device=device_path)
|
||||
print(f"Переподключён к {args['connection_id']}")
|
||||
return
|
||||
|
||||
raise RuntimeError(f"Устройство для интерфейса {interface_name} не найдено")
|
||||
raise RuntimeError(
|
||||
f"Устройство для интерфейса {interface_name} не найдено")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue