Skip to content

Commit 946874c

Browse files
jleboncgwalters
authored andcommitted
composefs/status: derive spec from staged deployment when present
The ostree backend derives `host.spec.image` from the staged deployment first, falling back to booted. This ensures the spec reflects the desired state after a `bootc switch`. But the composefs backend on the other hand was only deriving it from the booted deployment, which meant the spec never reflected a staged switch. Fix the composefs logic to match the ostree one. Heavily AI-guided. Signed-off-by: Jonathan Lebon <jonathan@jlebon.com>
1 parent 8cad0db commit 946874c

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

crates/lib/src/bootc_composefs/status.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,6 @@ async fn composefs_deployment_status_from(
890890
};
891891

892892
if verity_digest == booted_composefs_digest.as_ref() {
893-
host.spec.image = boot_entry.image.as_ref().map(|x| x.image.clone());
894893
host.status.booted = Some(boot_entry);
895894
continue;
896895
}
@@ -908,6 +907,15 @@ async fn composefs_deployment_status_from(
908907
extra_deployment_boot_entries.push(boot_entry);
909908
}
910909

910+
// see similar logic in the ostree-version of this
911+
host.spec.image = host
912+
.status
913+
.staged
914+
.as_ref()
915+
.or(host.status.booted.as_ref())
916+
.and_then(|entry| entry.image.as_ref())
917+
.map(|img| img.image.clone());
918+
911919
// Shouldn't really happen, but for sanity nonetheless
912920
let Some(boot_type) = boot_type else {
913921
anyhow::bail!("Could not determine boot type");

0 commit comments

Comments
 (0)