Skip to content

Commit

Permalink
Add hades health endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasjuhrich committed Nov 17, 2023
1 parent 71501db commit 81009b3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
3 changes: 2 additions & 1 deletion web/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from web.blueprints import task
from . import template_filters, template_tests
from .blueprints import (
facilities, finance, infrastructure, login, properties, user, host
facilities, finance, infrastructure, login, properties, user, host, health
)

from .blueprints.login import login_manager
Expand Down Expand Up @@ -99,6 +99,7 @@ def make_app(debug: bool = False, hades_logs: bool = True) -> PycroftFlask:
app.register_blueprint(task.bp, url_prefix="/task")
app.register_blueprint(login.bp)
app.register_blueprint(api.bp, url_prefix="/api/v0")
app.register_blueprint(health.bp, url_prefix="/health")

template_filters.register_filters(app)
template_tests.register_checks(app)
Expand Down
15 changes: 15 additions & 0 deletions web/blueprints/health/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from flask import Blueprint
from hades_logs import hades_logs
from hades_logs.exc import HadesError

bp = Blueprint("health", __name__)


@bp.route("hades-logs")
def hades():

Check failure on line 9 in web/blueprints/health/__init__.py

View workflow job for this annotation

GitHub Actions / python-lint

Error

Function is missing a return type annotation [no-untyped-def]
try:
hades_logs.fetch_logs(nasipaddress="10.160.0.75", nasportid="2/1/39")
except HadesError as e:
return f"CRIT {e}"
else:
return "OK"

0 comments on commit 81009b3

Please sign in to comment.