mirror of
https://github.com/home-assistant/core.git
synced 2025-08-02 18:18:21 +00:00
Add nameservers to supervisor system health response (#149749)
This commit is contained in:
parent
0d7608f7c5
commit
924a86dfb6
@ -9,6 +9,7 @@
|
|||||||
"healthy": "Healthy",
|
"healthy": "Healthy",
|
||||||
"host_os": "Host operating system",
|
"host_os": "Host operating system",
|
||||||
"installed_addons": "Installed add-ons",
|
"installed_addons": "Installed add-ons",
|
||||||
|
"nameservers": "Nameservers",
|
||||||
"supervisor_api": "Supervisor API",
|
"supervisor_api": "Supervisor API",
|
||||||
"supervisor_version": "Supervisor version",
|
"supervisor_version": "Supervisor version",
|
||||||
"supported": "Supported",
|
"supported": "Supported",
|
||||||
|
@ -54,6 +54,15 @@ async def system_health_info(hass: HomeAssistant) -> dict[str, Any]:
|
|||||||
"error": "Unsupported",
|
"error": "Unsupported",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nameservers = set()
|
||||||
|
for interface in network_info.get("interfaces", []):
|
||||||
|
if not interface.get("primary"):
|
||||||
|
continue
|
||||||
|
if ipv4 := interface.get("ipv4"):
|
||||||
|
nameservers.update(ipv4.get("nameservers", []))
|
||||||
|
if ipv6 := interface.get("ipv6"):
|
||||||
|
nameservers.update(ipv6.get("nameservers", []))
|
||||||
|
|
||||||
information = {
|
information = {
|
||||||
"host_os": host_info.get("operating_system"),
|
"host_os": host_info.get("operating_system"),
|
||||||
"update_channel": info.get("channel"),
|
"update_channel": info.get("channel"),
|
||||||
@ -62,6 +71,7 @@ async def system_health_info(hass: HomeAssistant) -> dict[str, Any]:
|
|||||||
"docker_version": info.get("docker"),
|
"docker_version": info.get("docker"),
|
||||||
"disk_total": f"{host_info.get('disk_total')} GB",
|
"disk_total": f"{host_info.get('disk_total')} GB",
|
||||||
"disk_used": f"{host_info.get('disk_used')} GB",
|
"disk_used": f"{host_info.get('disk_used')} GB",
|
||||||
|
"nameservers": ", ".join(nameservers),
|
||||||
"healthy": healthy,
|
"healthy": healthy,
|
||||||
"supported": supported,
|
"supported": supported,
|
||||||
"host_connectivity": network_info.get("host_internet"),
|
"host_connectivity": network_info.get("host_internet"),
|
||||||
|
@ -55,6 +55,10 @@ async def test_hassio_system_health(
|
|||||||
hass.data["hassio_network_info"] = {
|
hass.data["hassio_network_info"] = {
|
||||||
"host_internet": True,
|
"host_internet": True,
|
||||||
"supervisor_internet": True,
|
"supervisor_internet": True,
|
||||||
|
"interfaces": [
|
||||||
|
{"primary": False, "ipv4": {"nameservers": ["9.9.9.9"]}},
|
||||||
|
{"primary": True, "ipv4": {"nameservers": ["1.1.1.1"]}},
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
with patch.dict(os.environ, MOCK_ENVIRON):
|
with patch.dict(os.environ, MOCK_ENVIRON):
|
||||||
@ -76,6 +80,7 @@ async def test_hassio_system_health(
|
|||||||
"host_os": "Home Assistant OS 5.9",
|
"host_os": "Home Assistant OS 5.9",
|
||||||
"installed_addons": "Awesome Addon (1.0.0)",
|
"installed_addons": "Awesome Addon (1.0.0)",
|
||||||
"ntp_synchronized": True,
|
"ntp_synchronized": True,
|
||||||
|
"nameservers": "1.1.1.1",
|
||||||
"supervisor_api": "ok",
|
"supervisor_api": "ok",
|
||||||
"supervisor_version": "supervisor-2020.11.1",
|
"supervisor_version": "supervisor-2020.11.1",
|
||||||
"supported": True,
|
"supported": True,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user