mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-28 19:46:29 +00:00
commit
087b082a6b
2
API.md
2
API.md
@ -480,7 +480,7 @@ Get all available addons.
|
|||||||
"homeassistant_api": "bool",
|
"homeassistant_api": "bool",
|
||||||
"full_access": "bool",
|
"full_access": "bool",
|
||||||
"protected": "bool",
|
"protected": "bool",
|
||||||
"rating": "1-5",
|
"rating": "1-6",
|
||||||
"stdin": "bool",
|
"stdin": "bool",
|
||||||
"webui": "null|http(s)://[HOST]:port/xy/zx",
|
"webui": "null|http(s)://[HOST]:port/xy/zx",
|
||||||
"gpio": "bool",
|
"gpio": "bool",
|
||||||
|
@ -19,7 +19,7 @@ def rating_security(addon):
|
|||||||
1 = not secure
|
1 = not secure
|
||||||
5 = high secure
|
5 = high secure
|
||||||
"""
|
"""
|
||||||
rating = 4
|
rating = 5
|
||||||
|
|
||||||
# AppArmor
|
# AppArmor
|
||||||
if addon.apparmor == SECURITY_DISABLE:
|
if addon.apparmor == SECURITY_DISABLE:
|
||||||
@ -36,6 +36,10 @@ def rating_security(addon):
|
|||||||
PRIVILEGED_SYS_RAWIO):
|
PRIVILEGED_SYS_RAWIO):
|
||||||
rating += -1
|
rating += -1
|
||||||
|
|
||||||
|
# Not secure Networking
|
||||||
|
if addon.host_network:
|
||||||
|
rating += -1
|
||||||
|
|
||||||
# Full Access
|
# Full Access
|
||||||
if addon.with_full_access:
|
if addon.with_full_access:
|
||||||
rating += -2
|
rating += -2
|
||||||
@ -44,7 +48,7 @@ def rating_security(addon):
|
|||||||
if addon.access_docker_api:
|
if addon.access_docker_api:
|
||||||
rating = 1
|
rating = 1
|
||||||
|
|
||||||
return max(min(5, rating), 1)
|
return max(min(6, rating), 1)
|
||||||
|
|
||||||
|
|
||||||
def get_hash_from_repository(name):
|
def get_hash_from_repository(name):
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from ipaddress import ip_network
|
from ipaddress import ip_network
|
||||||
|
|
||||||
HASSIO_VERSION = '126'
|
HASSIO_VERSION = '127'
|
||||||
|
|
||||||
URL_HASSIO_ADDONS = "https://github.com/home-assistant/hassio-addons"
|
URL_HASSIO_ADDONS = "https://github.com/home-assistant/hassio-addons"
|
||||||
URL_HASSIO_VERSION = \
|
URL_HASSIO_VERSION = \
|
||||||
|
@ -102,6 +102,8 @@ class DockerHomeAssistant(DockerInterface):
|
|||||||
{'bind': '/config', 'mode': 'rw'},
|
{'bind': '/config', 'mode': 'rw'},
|
||||||
str(self.sys_config.path_extern_ssl):
|
str(self.sys_config.path_extern_ssl):
|
||||||
{'bind': '/ssl', 'mode': 'ro'},
|
{'bind': '/ssl', 'mode': 'ro'},
|
||||||
|
str(self.sys_config.path_extern_share):
|
||||||
|
{'bind': '/share', 'mode': 'ro'},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ from contextlib import asynccontextmanager, suppress
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
from pathlib import Path
|
||||||
import socket
|
import socket
|
||||||
import time
|
import time
|
||||||
|
|
||||||
@ -437,6 +438,9 @@ class HomeAssistant(JsonConfig, CoreSysAttributes):
|
|||||||
async def _block_till_run(self):
|
async def _block_till_run(self):
|
||||||
"""Block until Home-Assistant is booting up or startup timeout."""
|
"""Block until Home-Assistant is booting up or startup timeout."""
|
||||||
start_time = time.monotonic()
|
start_time = time.monotonic()
|
||||||
|
migration_progress = False
|
||||||
|
migration_file = Path(
|
||||||
|
self.sys_config.path_homeassistant, '.migration_progress')
|
||||||
|
|
||||||
def check_port():
|
def check_port():
|
||||||
"""Check if port is mapped."""
|
"""Check if port is mapped."""
|
||||||
@ -452,21 +456,39 @@ class HomeAssistant(JsonConfig, CoreSysAttributes):
|
|||||||
pass
|
pass
|
||||||
return False
|
return False
|
||||||
|
|
||||||
while time.monotonic() - start_time < self.wait_boot:
|
while True:
|
||||||
|
await asyncio.sleep(10)
|
||||||
|
|
||||||
|
# 1
|
||||||
|
# Check if Container is is_running
|
||||||
|
if not await self.instance.is_running():
|
||||||
|
_LOGGER.error("HomeAssistant is crashed!")
|
||||||
|
break
|
||||||
|
|
||||||
|
# 2
|
||||||
# Check if API response
|
# Check if API response
|
||||||
if await self.sys_run_in_executor(check_port):
|
if await self.sys_run_in_executor(check_port):
|
||||||
_LOGGER.info("Detect a running HomeAssistant instance")
|
_LOGGER.info("Detect a running HomeAssistant instance")
|
||||||
self._error_state = False
|
self._error_state = False
|
||||||
return
|
return
|
||||||
|
|
||||||
# wait and don't hit the system
|
# 3
|
||||||
await asyncio.sleep(10)
|
# Running DB Migration
|
||||||
|
if migration_file.exists():
|
||||||
|
if not migration_progress:
|
||||||
|
migration_progress = True
|
||||||
|
_LOGGER.info("HomeAssistant record migration in progress")
|
||||||
|
continue
|
||||||
|
elif migration_progress:
|
||||||
|
migration_progress = False # Reset start time
|
||||||
|
start_time = time.monotonic()
|
||||||
|
_LOGGER.info("HomeAssistant record migration done")
|
||||||
|
|
||||||
# Check if Container is is_running
|
# 4
|
||||||
if not await self.instance.is_running():
|
# Timeout
|
||||||
_LOGGER.error("Home Assistant is crashed!")
|
if time.monotonic() - start_time > self.wait_boot:
|
||||||
|
_LOGGER.warning("Don't wait anymore of HomeAssistant startup!")
|
||||||
break
|
break
|
||||||
|
|
||||||
_LOGGER.warning("Don't wait anymore of HomeAssistant startup!")
|
|
||||||
self._error_state = True
|
self._error_state = True
|
||||||
raise HomeAssistantError()
|
raise HomeAssistantError()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user