mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-07 17:26:32 +00:00
Never disable interfaces at startup (#3676)
This commit is contained in:
parent
b82dbc0cac
commit
3b3cd61e3d
@ -119,6 +119,10 @@ class NetworkManager(CoreSysAttributes):
|
||||
self.apply_changes(interface, update_only=True)
|
||||
for interface in interfaces
|
||||
if interface.enabled
|
||||
and (
|
||||
interface.ipv4.method != InterfaceMethod.DISABLED
|
||||
or interface.ipv6.method != InterfaceMethod.DISABLED
|
||||
)
|
||||
]
|
||||
)
|
||||
|
||||
|
@ -2,6 +2,9 @@
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
from supervisor.coresys import CoreSys
|
||||
from supervisor.dbus.const import InterfaceMethod
|
||||
from supervisor.host.const import InterfaceType
|
||||
from supervisor.host.network import Interface, IpConfig
|
||||
|
||||
|
||||
async def test_load(coresys: CoreSys):
|
||||
@ -24,8 +27,32 @@ async def test_load(coresys: CoreSys):
|
||||
assert coresys.host.network.interfaces[1].name == "wlan0"
|
||||
assert coresys.host.network.interfaces[1].enabled is False
|
||||
|
||||
assert activate_connection.call_count == 1
|
||||
assert activate_connection.call_args.args == (
|
||||
activate_connection.assert_called_once_with(
|
||||
"/org/freedesktop/NetworkManager/Settings/1",
|
||||
"/org/freedesktop/NetworkManager/Devices/1",
|
||||
)
|
||||
|
||||
|
||||
async def test_load_with_disabled_methods(coresys: CoreSys):
|
||||
"""Test load does not disable methods of interfaces."""
|
||||
with patch(
|
||||
"supervisor.host.network.Interface.from_dbus_interface",
|
||||
return_value=Interface(
|
||||
"eth0",
|
||||
True,
|
||||
False,
|
||||
False,
|
||||
InterfaceType.ETHERNET,
|
||||
IpConfig(InterfaceMethod.DISABLED, [], None, []),
|
||||
IpConfig(InterfaceMethod.DISABLED, [], None, []),
|
||||
None,
|
||||
None,
|
||||
),
|
||||
), patch.object(
|
||||
coresys.host.sys_dbus.network,
|
||||
"activate_connection",
|
||||
new=Mock(wraps=coresys.host.sys_dbus.network.activate_connection),
|
||||
) as activate_connection:
|
||||
await coresys.host.network.load()
|
||||
|
||||
activate_connection.assert_not_called()
|
||||
|
Loading…
x
Reference in New Issue
Block a user