Skip to content

directory logs is not created by teapot #7

@wetzel-desy

Description

@wetzel-desy

Short Description of the issue

When starting teapot for the first time, it throws an exception if the logs directory does not exist because it can't store the log files and teapot_sessions.json

Environment

irrelevant.

  • Operating System: all
  • Other related components versions: irrelevant

Steps to reproduce

start teapot without /home/teapot//logs being created

Logs, stacktrace, or other symptoms

ERROR:    Traceback (most recent call last):
  File "/home/teapot/.local/lib/python3.10/site-packages/starlette/routing.py", line 677, in lifespan
    async with self.lifespan_context(app) as maybe_state:
  File "/usr/local/lib/python3.10/contextlib.py", line 199, in __aenter__
    return await anext(self.gen)
  File "/usr/share/teapot/teapot.py", line 44, in lifespan
    await load_session_state()
  File "/usr/share/teapot/teapot.py", line 482, in load_session_state
    with open(SESSION_STORE_PATH, "w") as f:
FileNotFoundError: [Errno 2] No such file or directory: '/home/teapot/logs/teapot_sessions.json'

ERROR:    Application startup failed. Exiting.

Summary of proposed changes

check if directory exists in lifespan function and create it if not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions