fix: check for shell scripts only on RaspiBlitz

This commit is contained in:
fusion44 2022-08-18 20:11:36 +02:00
parent 3764d7b4bf
commit ecfaadd0c1
2 changed files with 14 additions and 15 deletions

View file

@ -1,6 +1,5 @@
import asyncio
import re
from os import path
from decouple import config
from fastapi import HTTPException, Request, status
@ -38,20 +37,6 @@ elif PLATFORM == APIPlatform.NATIVE_PYTHON:
else:
raise RuntimeError(f"Unknown platform {PLATFORM}")
SHELL_SCRIPT_PATH = config("shell_script_path")
GET_DEBUG_LOG_SCRIPT = path.join(SHELL_SCRIPT_PATH, "config.scripts", "blitz.debug.sh")
def _check_shell_scripts_status():
if not path.exists(SHELL_SCRIPT_PATH):
raise Exception(f"invalid shell script path: {SHELL_SCRIPT_PATH}")
if not path.isfile(GET_DEBUG_LOG_SCRIPT):
raise Exception(f"Required file does not exist: {GET_DEBUG_LOG_SCRIPT}")
_check_shell_scripts_status()
def password_valid(password: str):
if len(password) < 8:

View file

@ -16,6 +16,20 @@ from app.utils import (
)
SHELL_SCRIPT_PATH = config("shell_script_path")
GET_DEBUG_LOG_SCRIPT = os.path.join(
SHELL_SCRIPT_PATH, "config.scripts", "blitz.debug.sh"
)
def _check_shell_scripts_status():
if not os.path.exists(SHELL_SCRIPT_PATH):
raise Exception(f"invalid shell script path: {SHELL_SCRIPT_PATH}")
if not os.path.isfile(GET_DEBUG_LOG_SCRIPT):
raise Exception(f"Required file does not exist: {GET_DEBUG_LOG_SCRIPT}")
_check_shell_scripts_status()
async def get_system_info_impl() -> SystemInfo: