Enable connectivity on startup (#2879)

* Check connectivity on system startup

* move it
This commit is contained in:
Pascal Vizeli 2021-05-12 16:02:51 +02:00 committed by GitHub
parent d8d594c728
commit b234c18664
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 6 deletions

View File

@ -96,6 +96,9 @@ class Core(CoreSysAttributes):
"""Start setting up supervisor orchestration."""
self.state = CoreState.SETUP
# Check internet on startup
await self.sys_supervisor.check_connectivity()
# Order can be important!
setup_loads: List[Awaitable[None]] = [
# rest api views
@ -158,9 +161,6 @@ class Core(CoreSysAttributes):
"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
await self.sys_hassos.mark_healthy()

View File

@ -153,7 +153,6 @@ class Job(CoreSysAttributes):
if (
JobCondition.INTERNET_SYSTEM in self.conditions
and not self.sys_supervisor.connectivity
and self.sys_core.state in (CoreState.SETUP, CoreState.RUNNING)
):
raise JobConditionException(
f"'{self._method.__qualname__}' blocked from execution, no supervisor internet connection"
@ -163,7 +162,6 @@ class Job(CoreSysAttributes):
JobCondition.INTERNET_HOST in self.conditions
and self.sys_host.network.connectivity is not None
and not self.sys_host.network.connectivity
and self.sys_core.state in (CoreState.SETUP, CoreState.RUNNING)
):
raise JobConditionException(
f"'{self._method.__qualname__}' blocked from execution, no host internet connection"

View File

@ -143,6 +143,7 @@ class PluginDns(PluginBase):
# Update supervisor
self._write_resolv(HOST_RESOLV)
await self.sys_supervisor.check_connectivity()
async def install(self) -> None:
"""Install CoreDNS."""

View File

@ -241,7 +241,7 @@ class Supervisor(CoreSysAttributes):
timeout = aiohttp.ClientTimeout(total=10)
try:
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):
self.connectivity = False