Skip to content

Commit

Permalink
api path fixation
Browse files Browse the repository at this point in the history
  • Loading branch information
witlox committed Jan 13, 2025
1 parent 5cc0876 commit c01d4aa
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
11 changes: 10 additions & 1 deletion horao/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"""
import logging
import os
from pathlib import Path
from typing import Optional

from opentelemetry import metrics, trace # type: ignore
Expand Down Expand Up @@ -95,6 +96,14 @@
metrics.set_meter_provider(meter_provider)


def get_project_root() -> Path:
"""
Get the project root
:return: path to project root
"""
return Path(__file__).parent


def init(authorization: Optional[AuthenticationBackend] = None) -> Starlette:
"""
Initialize the API
Expand Down Expand Up @@ -149,7 +158,7 @@ def init(authorization: Optional[AuthenticationBackend] = None) -> Starlette:
title="Horao",
specification_url="/spec/",
redoc_url="/docs/",
template="openapi/openapi.yml",
template=str(Path.joinpath(get_project_root(), "openapi/openapi.yml")),
)
apiman.init_app(app)
if os.getenv("TELEMETRY", "ON") == "OFF":
Expand Down
2 changes: 1 addition & 1 deletion horao/api/user_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ async def create_reservation(request: Request) -> JSONResponse:
"500":
description: Error processing reservation
"""
logging.debug(f"Calling Reservations ({request})")
logging.debug(f"Creating Reservation ({request})")
try:
data = await request.json()
claim = json.loads(data, cls=HoraoDecoder)
Expand Down
2 changes: 1 addition & 1 deletion horao/controllers/synchronization.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def synchronize(self, changes: Optional[List] = None) -> datetime | None:
will only call synchronize if there are any changes if the timer expires
note: currently only the infrastructure is tracked, changes to claims and constraints are not tracked
:param changes: optional list of changes
:return: None
:return: None (if nothing happened) or datetime if synchronized
"""
if not self.peers:
return None
Expand Down

0 comments on commit c01d4aa

Please sign in to comment.