Fix Idunn Gjallar empty-panel health

This commit is contained in:
Meta Vens 2026-06-15 19:44:48 +01:00
commit 80243b7a1a

View file

@ -601,15 +601,18 @@ fn probe_health(
detail: command_output_detail("health command exited successfully", &output),
observed_at: observed_at.to_string(),
},
Ok(output) => IdunnDaemonHealthRecord {
daemon_id: target.daemon_id.clone(),
state: "failed".to_string(),
detail: command_output_detail(
Ok(output) => {
let detail = command_output_detail(
&format!("health command exited with {}", output.status),
&output,
),
observed_at: observed_at.to_string(),
},
);
IdunnDaemonHealthRecord {
daemon_id: target.daemon_id.clone(),
state: health_state_from_detail(&detail).to_string(),
detail,
observed_at: observed_at.to_string(),
}
}
Err(error) => IdunnDaemonHealthRecord {
daemon_id: target.daemon_id.clone(),
state: "failed".to_string(),
@ -626,6 +629,22 @@ fn probe_health(
}
}
fn health_state_from_detail(detail: &str) -> &str {
for state in [
"stale-deployment",
"dependency-unavailable",
"degraded",
"failed",
] {
let marker = format!("idunn.health.state={state}");
if detail.contains(&marker) {
return state;
}
}
"failed"
}
fn run_restart(
request: &odin_core::IdunnRestartRequestRecord,
requested_at: &str,