1
0
mirror of https://github.com/home-assistant/supervisor.git synced 2025-12-24 12:29:08 +00:00

Enforce env check (#1565)

This commit is contained in:
Pascal Vizeli
2020-03-04 18:15:10 +01:00
committed by GitHub
parent e91983adb4
commit c02f30dd7e
3 changed files with 3 additions and 10 deletions

View File

@@ -30,8 +30,7 @@ if __name__ == "__main__":
loop = initialize_event_loop()
# Check if all information are available to setup Supervisor
if not bootstrap.check_environment():
sys.exit(1)
bootstrap.check_environment()
# init executor pool
executor = ThreadPoolExecutor(thread_name_prefix="SyncWorker")

View File

@@ -197,7 +197,7 @@ def initialize_logging():
)
def check_environment():
def check_environment() -> None:
"""Check if all environment are exists."""
# check environment variables
for key in (ENV_SHARE, ENV_NAME, ENV_REPO):
@@ -205,24 +205,18 @@ def check_environment():
os.environ[key]
except KeyError:
_LOGGER.fatal("Can't find %s in env!", key)
return False
# check docker socket
if not SOCKET_DOCKER.is_socket():
_LOGGER.fatal("Can't find Docker socket!")
return False
# check socat exec
if not shutil.which("socat"):
_LOGGER.fatal("Can't find socat!")
return False
# check socat exec
if not shutil.which("gdbus"):
_LOGGER.fatal("Can't find gdbus!")
return False
return True
def reg_signal(loop):

View File

@@ -28,7 +28,7 @@ FILE_HASSIO_INGRESS = Path(SUPERVISOR_DATA, "ingress.json")
FILE_HASSIO_DNS = Path(SUPERVISOR_DATA, "dns.json")
FILE_HASSIO_AUDIO = Path(SUPERVISOR_DATA, "audio.json")
SOCKET_DOCKER = Path("/var/run/docker.sock")
SOCKET_DOCKER = Path("/run/docker.sock")
DOCKER_NETWORK = "hassio"
DOCKER_NETWORK_MASK = ip_network("172.30.32.0/23")