mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-06-19 03:05:24 -04:00
fix(cookbook): locate cookbook_state.json via DATA_DIR, not hardcoded /app/data (#3332)
Three call sites hardcoded Path("/app/data/cookbook_state.json"), which only
exists in Docker; on a native run the real path is <repo>/data, so the state
file looked missing and cookbook serve-state was silently ignored. Two others
used os.environ.get("DATA_DIR", "data") (a relative fallback, since DATA_DIR is
never set as an env var). Route all five through core.constants.DATA_DIR so the
path is consistent and absolute on both Docker and native.
Part of #3331.
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
committed by
GitHub
parent
9c90f62657
commit
505d8bae5a
@@ -12,7 +12,7 @@ from typing import Tuple
|
||||
|
||||
from src.auth_helpers import owner_filter
|
||||
from core.platform_compat import IS_WINDOWS, find_bash
|
||||
from core.constants import internal_api_base
|
||||
from core.constants import DATA_DIR, internal_api_base
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -2043,7 +2043,7 @@ async def action_cookbook_serve(
|
||||
except Exception:
|
||||
end_after_min = 0
|
||||
|
||||
state_path = Path("/app/data/cookbook_state.json")
|
||||
state_path = Path(DATA_DIR) / "cookbook_state.json"
|
||||
try:
|
||||
state = json.loads(state_path.read_text(encoding="utf-8")) if state_path.exists() else {}
|
||||
except Exception:
|
||||
|
||||
@@ -19,7 +19,7 @@ import time
|
||||
from pathlib import Path
|
||||
|
||||
import httpx
|
||||
from core.constants import internal_api_base
|
||||
from core.constants import DATA_DIR, internal_api_base
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -130,7 +130,7 @@ async def _stop_serve(session_id: str, remote_host: str = "", ssh_port: str = ""
|
||||
|
||||
|
||||
async def _tick() -> None:
|
||||
state_path = Path("/app/data/cookbook_state.json")
|
||||
state_path = Path(DATA_DIR) / "cookbook_state.json"
|
||||
if not state_path.exists():
|
||||
return
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user