mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-08 17:56:33 +00:00
Enable connectivity on startup (#2879)
* Check connectivity on system startup * move it
This commit is contained in:
parent
d8d594c728
commit
b234c18664
@ -96,6 +96,9 @@ class Core(CoreSysAttributes):
|
|||||||
"""Start setting up supervisor orchestration."""
|
"""Start setting up supervisor orchestration."""
|
||||||
self.state = CoreState.SETUP
|
self.state = CoreState.SETUP
|
||||||
|
|
||||||
|
# Check internet on startup
|
||||||
|
await self.sys_supervisor.check_connectivity()
|
||||||
|
|
||||||
# Order can be important!
|
# Order can be important!
|
||||||
setup_loads: List[Awaitable[None]] = [
|
setup_loads: List[Awaitable[None]] = [
|
||||||
# rest api views
|
# rest api views
|
||||||
@ -158,9 +161,6 @@ class Core(CoreSysAttributes):
|
|||||||
"System is running in an unhealthy state and needs manual intervention!"
|
"System is running in an unhealthy state and needs manual intervention!"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Check internet on startup
|
|
||||||
await self.sys_supervisor.check_connectivity()
|
|
||||||
|
|
||||||
# Mark booted partition as healthy
|
# Mark booted partition as healthy
|
||||||
await self.sys_hassos.mark_healthy()
|
await self.sys_hassos.mark_healthy()
|
||||||
|
|
||||||
|
@ -153,7 +153,6 @@ class Job(CoreSysAttributes):
|
|||||||
if (
|
if (
|
||||||
JobCondition.INTERNET_SYSTEM in self.conditions
|
JobCondition.INTERNET_SYSTEM in self.conditions
|
||||||
and not self.sys_supervisor.connectivity
|
and not self.sys_supervisor.connectivity
|
||||||
and self.sys_core.state in (CoreState.SETUP, CoreState.RUNNING)
|
|
||||||
):
|
):
|
||||||
raise JobConditionException(
|
raise JobConditionException(
|
||||||
f"'{self._method.__qualname__}' blocked from execution, no supervisor internet connection"
|
f"'{self._method.__qualname__}' blocked from execution, no supervisor internet connection"
|
||||||
@ -163,7 +162,6 @@ class Job(CoreSysAttributes):
|
|||||||
JobCondition.INTERNET_HOST in self.conditions
|
JobCondition.INTERNET_HOST in self.conditions
|
||||||
and self.sys_host.network.connectivity is not None
|
and self.sys_host.network.connectivity is not None
|
||||||
and not self.sys_host.network.connectivity
|
and not self.sys_host.network.connectivity
|
||||||
and self.sys_core.state in (CoreState.SETUP, CoreState.RUNNING)
|
|
||||||
):
|
):
|
||||||
raise JobConditionException(
|
raise JobConditionException(
|
||||||
f"'{self._method.__qualname__}' blocked from execution, no host internet connection"
|
f"'{self._method.__qualname__}' blocked from execution, no host internet connection"
|
||||||
|
@ -143,6 +143,7 @@ class PluginDns(PluginBase):
|
|||||||
|
|
||||||
# Update supervisor
|
# Update supervisor
|
||||||
self._write_resolv(HOST_RESOLV)
|
self._write_resolv(HOST_RESOLV)
|
||||||
|
await self.sys_supervisor.check_connectivity()
|
||||||
|
|
||||||
async def install(self) -> None:
|
async def install(self) -> None:
|
||||||
"""Install CoreDNS."""
|
"""Install CoreDNS."""
|
||||||
|
@ -241,7 +241,7 @@ class Supervisor(CoreSysAttributes):
|
|||||||
timeout = aiohttp.ClientTimeout(total=10)
|
timeout = aiohttp.ClientTimeout(total=10)
|
||||||
try:
|
try:
|
||||||
await self.sys_websession.head(
|
await self.sys_websession.head(
|
||||||
"https://version.home-assistant.io/online.txt", timeout=timeout
|
"http://version.home-assistant.io/online.txt", timeout=timeout
|
||||||
)
|
)
|
||||||
except (ClientError, asyncio.TimeoutError):
|
except (ClientError, asyncio.TimeoutError):
|
||||||
self.connectivity = False
|
self.connectivity = False
|
||||||
|
Loading…
x
Reference in New Issue
Block a user