mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-25 18:16:32 +00:00
Preserve ordering of locals (#1263)
* Preserve ordering of locals * fix lint
This commit is contained in:
parent
937b31d845
commit
b898cd2a3a
@ -1,6 +1,6 @@
|
|||||||
"""Info control for host."""
|
"""Info control for host."""
|
||||||
import logging
|
import logging
|
||||||
from typing import List, Set
|
from typing import List
|
||||||
|
|
||||||
from ..coresys import CoreSysAttributes, CoreSys
|
from ..coresys import CoreSysAttributes, CoreSys
|
||||||
from ..exceptions import HostNotSupportedError, DBusNotConnectedError, DBusError
|
from ..exceptions import HostNotSupportedError, DBusNotConnectedError, DBusError
|
||||||
@ -19,13 +19,13 @@ class NetworkManager(CoreSysAttributes):
|
|||||||
def dns_servers(self) -> List[str]:
|
def dns_servers(self) -> List[str]:
|
||||||
"""Return a list of local DNS servers."""
|
"""Return a list of local DNS servers."""
|
||||||
# Read all local dns servers
|
# Read all local dns servers
|
||||||
servers: Set[str] = set()
|
servers: List[str] = []
|
||||||
for config in self.sys_dbus.nmi_dns.configuration:
|
for config in self.sys_dbus.nmi_dns.configuration:
|
||||||
if config.vpn or not config.nameservers:
|
if config.vpn or not config.nameservers:
|
||||||
continue
|
continue
|
||||||
servers |= set(config.nameservers)
|
servers.extend(config.nameservers)
|
||||||
|
|
||||||
return [f"dns://{server}" for server in servers]
|
return [f"dns://{server}" for server in list(dict.fromkeys(servers))]
|
||||||
|
|
||||||
async def update(self):
|
async def update(self):
|
||||||
"""Update properties over dbus."""
|
"""Update properties over dbus."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user