fix: bind reboot success to independently received inventory within reserved deadline
Rust development slice / linux (push) Failing after 6s

This commit is contained in:
2026-11-13 19:49:12 +01:00
parent d8bf8e238b
commit b3a22d464b
9 changed files with 1048 additions and 27 deletions
+4 -7
View File
@@ -189,13 +189,10 @@ pub async fn event(
}
}
if matches!(payload.action, Action::Reboot { .. }) {
ensure!(
evidence.get("new_boot_id").and_then(Value::as_str)
== Some(e.boot_id.as_str()),
"new boot evidence required"
);
let old_boot=sqlx::query_scalar::<_,String>("SELECT data->>'boot_id' FROM audit_events WHERE event_type='start_reserved' AND data->>'job_id'=$1 ORDER BY created_at DESC LIMIT 1").bind(&r.job_id).fetch_one(&mut **tx).await?;
ensure!(old_boot != e.boot_id, "reboot needs new boot");
crate::synchronization::verify_reboot_success(
tx, tenant, agent, e, &payload, r, &evidence,
)
.await?;
}
}
sqlx::query("UPDATE jobs SET state=$2,revision=$3,result=$4 WHERE job_id=$1")