Skip to content

Commit 4cb64bb

Browse files
chaserhkjgemini-code-assist[bot]
authored andcommitted
nit: Fix typo and improve readability
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Signed-off-by: Chaser Huang <[email protected]>
1 parent 1670cdc commit 4cb64bb

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

crates/lib/src/bootc_composefs/status.rs

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -712,21 +712,22 @@ pub(crate) async fn composefs_deployment_status_from(
712712
.map(|menu| menu.get_verity()),
713713
)
714714
.collect::<Result<HashSet<_>>>()?;
715-
for entry in extra_deployment_boot_entries {
716-
// SAFETY: boot_entry.composefs will always be present
717-
let verity = &entry.composefs.as_ref().unwrap().verity;
718-
if bootloader_configured_verity.contains(verity) {
719-
match host.status.rollback {
720-
Some(ref _entry) => {
721-
anyhow::bail!(
722-
"Multiple extra entires in /boot, could not determine rollback entry"
723-
);
724-
}
725-
None => {
726-
host.status.rollback = Some(entry);
727-
}
728-
}
729-
}
715+
let rollback_candidates: Vec<_> = extra_deployment_boot_entries
716+
.into_iter()
717+
.filter(|entry| {
718+
let verity = &entry
719+
.composefs
720+
.as_ref()
721+
.expect("composefs is always Some for composefs deployments")
722+
.verity;
723+
bootloader_configured_verity.contains(verity)
724+
})
725+
.collect();
726+
727+
if rollback_candidates.len() > 1 {
728+
anyhow::bail!("Multiple extra entries in /boot, could not determine rollback entry");
729+
} else if let Some(rollback_entry) = rollback_candidates.into_iter().next() {
730+
host.status.rollback = Some(rollback_entry);
730731
}
731732

732733
host.status.rollback_queued = is_rollback_queued;

0 commit comments

Comments
 (0)