Fix Idunn Gjallar empty-panel health
This commit is contained in:
parent
afb612bdbb
commit
80243b7a1a
1 changed files with 26 additions and 7 deletions
33
src/main.rs
33
src/main.rs
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in a new issue