fix: reconcile configured APT effect without retroactive acceptance and retain host reboot evidence
Rust development slice / linux (push) Failing after 6s
Rust development slice / linux (push) Failing after 6s
This commit is contained in:
@@ -526,9 +526,16 @@ fn verify_proof(
|
||||
Ok(())
|
||||
}
|
||||
fn probe(c: &Candidate) -> Result<ProbeOutput> {
|
||||
Ok(serde_json::from_slice(&probe_mode(c, "verify-partial")?)?)
|
||||
}
|
||||
fn probe_mode(c: &Candidate, mode: &str) -> Result<Vec<u8>> {
|
||||
ensure!(
|
||||
matches!(mode, "verify-partial" | "verify-configured-recovery"),
|
||||
"APT_RECONCILE_PROBE_MODE"
|
||||
);
|
||||
apt::verify_installation()?;
|
||||
let mut child = Command::new("/usr/bin/python3")
|
||||
.args(["-I", apt::CODE, "verify-partial"])
|
||||
.args(["-I", apt::CODE, mode])
|
||||
.env_clear()
|
||||
.env("PATH", "/usr/bin:/bin")
|
||||
.env("LC_ALL", "C")
|
||||
@@ -558,7 +565,7 @@ fn probe(c: &Candidate) -> Result<ProbeOutput> {
|
||||
}
|
||||
let status = child.wait()?;
|
||||
ensure!(status.success() && !overflow, "APT_RECONCILE_NOT_PROVEN");
|
||||
Ok(serde_json::from_slice(&bytes)?)
|
||||
Ok(bytes)
|
||||
}
|
||||
fn persist(db: &mut Connection, c: &Candidate, proof: &PartialProof) -> Result<()> {
|
||||
let proof_bytes = serde_json::to_vec(&serde_json::to_value(proof)?)?;
|
||||
@@ -636,6 +643,9 @@ pub fn refresh(
|
||||
drop(statement);
|
||||
ensure!(rows.len() <= 256, "APT_RECONCILE_CAPACITY");
|
||||
for row in rows {
|
||||
if configured::refresh(db, binding, &row, now)? {
|
||||
continue;
|
||||
}
|
||||
let Some(candidate) = eligible(binding, row)? else {
|
||||
continue;
|
||||
};
|
||||
@@ -658,6 +668,9 @@ pub fn refresh(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[path = "apt_configured_reconcile.rs"]
|
||||
mod configured;
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
Reference in New Issue
Block a user