api: log errors if app URLs import fail (#6397)
* api: log errors if app URLs import fail Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space> * bump level to warning Signed-off-by: Jens Langhammer <jens@goauthentik.io> --------- Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space> Signed-off-by: Jens Langhammer <jens@goauthentik.io> Co-authored-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
parent
f272d14fcf
commit
94836a3ce7
|
@ -21,9 +21,14 @@ _other_urls = []
|
||||||
for _authentik_app in get_apps():
|
for _authentik_app in get_apps():
|
||||||
try:
|
try:
|
||||||
api_urls = import_module(f"{_authentik_app.name}.urls")
|
api_urls = import_module(f"{_authentik_app.name}.urls")
|
||||||
except (ModuleNotFoundError, ImportError):
|
except (ModuleNotFoundError, ImportError) as exc:
|
||||||
|
LOGGER.warning("Could not import app's URLs", app_name=_authentik_app.name, exception=exc)
|
||||||
continue
|
continue
|
||||||
if not hasattr(api_urls, "api_urlpatterns"):
|
if not hasattr(api_urls, "api_urlpatterns"):
|
||||||
|
LOGGER.debug(
|
||||||
|
"App does not define API URLs",
|
||||||
|
app_name=_authentik_app.name,
|
||||||
|
)
|
||||||
continue
|
continue
|
||||||
urls: list = getattr(api_urls, "api_urlpatterns")
|
urls: list = getattr(api_urls, "api_urlpatterns")
|
||||||
for url in urls:
|
for url in urls:
|
||||||
|
|
Reference in New Issue