Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Official
AlekSIS-Core
Commits
c8391845
Verified
Commit
c8391845
authored
4 years ago
by
Jonathan Weth
Browse files
Options
Downloads
Patches
Plain Diff
Add custom health check for data checks
parent
79bbb7b7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!389
Add data check system
Pipeline
#4831
passed
4 years ago
Stage: test
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aleksis/core/apps.py
+5
-0
5 additions, 0 deletions
aleksis/core/apps.py
aleksis/core/health_checks.py
+18
-0
18 additions, 0 deletions
aleksis/core/health_checks.py
with
23 additions
and
0 deletions
aleksis/core/apps.py
+
5
−
0
View file @
c8391845
...
...
@@ -7,6 +7,7 @@ from django.http import HttpRequest
from
django.utils.module_loading
import
autodiscover_modules
from
dynamic_preferences.registries
import
preference_models
from
health_check.plugins
import
plugin_dir
from
.registries
import
(
group_preferences_registry
,
...
...
@@ -52,6 +53,10 @@ class CoreConfig(AppConfig):
self
.
_refresh_authentication_backends
()
from
.health_checks
import
DataChecksHealthCheckBackend
plugin_dir
.
register
(
DataChecksHealthCheckBackend
)
@classmethod
def
_refresh_authentication_backends
(
cls
):
"""
Refresh config list of enabled authentication backends.
"""
...
...
This diff is collapsed.
Click to expand it.
aleksis/core/health_checks.py
0 → 100644
+
18
−
0
View file @
c8391845
from
django.utils.translation
import
gettext
as
_
from
health_check.backends
import
BaseHealthCheckBackend
from
aleksis.core.models
import
DataCheckResult
class
DataChecksHealthCheckBackend
(
BaseHealthCheckBackend
):
"""
Checks whether there are unresolved data problems.
"""
critical_service
=
False
def
check_status
(
self
):
if
DataCheckResult
.
objects
.
filter
(
solved
=
False
).
exists
():
self
.
add_error
(
_
(
"
There are unresolved data problems.
"
))
def
identifier
(
self
):
return
self
.
__class__
.
__name__
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment