mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 12:11:56 +00:00
adds name, description; changes critical boolean to severity enum (#855)
This commit is contained in:
committed by
Aiden McClelland
parent
e5f1c4c955
commit
a90c3cb3a1
@@ -67,11 +67,20 @@ impl HealthChecks {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
pub enum HealthCheckSeverity {
|
||||
Warning,
|
||||
Critical,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct HealthCheck {
|
||||
pub name: String,
|
||||
pub description: String,
|
||||
#[serde(flatten)]
|
||||
implementation: ActionImplementation,
|
||||
pub critical: bool,
|
||||
pub severity: HealthCheckSeverity,
|
||||
pub timeout: Option<Duration>,
|
||||
}
|
||||
impl HealthCheck {
|
||||
|
||||
@@ -5,7 +5,7 @@ use patch_db::{DbHandle, HasModel};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tracing::instrument;
|
||||
|
||||
use self::health_check::HealthCheckId;
|
||||
use self::health_check::{HealthCheckId, HealthCheckSeverity};
|
||||
use crate::context::RpcContext;
|
||||
use crate::dependencies::DependencyErrors;
|
||||
use crate::notifications::NotificationLevel;
|
||||
@@ -67,7 +67,7 @@ impl MainStatus {
|
||||
.health_checks
|
||||
.0
|
||||
.get(check)
|
||||
.map(|hc| hc.critical)
|
||||
.map(|hc| hc.severity == HealthCheckSeverity::Critical)
|
||||
.unwrap_or_default() =>
|
||||
{
|
||||
ctx.notification_manager.notify(
|
||||
|
||||
Reference in New Issue
Block a user