Skip to content

Commit 5a00f3a

Browse files
committed
status: Pass entry to render functions
Prep for displaying more information, like pinned state. Signed-off-by: Colin Walters <[email protected]>
1 parent 8c005f5 commit 5a00f3a

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

lib/src/status.rs

+12-3
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,7 @@ fn write_row_name(mut out: impl Write, s: &str, prefix_len: usize) -> Result<()>
362362
fn human_render_slot(
363363
mut out: impl Write,
364364
slot: Slot,
365+
entry: &crate::spec::BootEntry,
365366
image: &crate::spec::ImageStatus,
366367
) -> Result<()> {
367368
let transport = &image.image.transport;
@@ -407,11 +408,18 @@ fn human_render_slot(
407408
writeln!(out, "{timestamp}")?;
408409
}
409410

411+
tracing::debug!("pinned={}", entry.pinned);
412+
410413
Ok(())
411414
}
412415

413416
/// Output a rendering of a non-container boot entry.
414-
fn human_render_slot_ostree(mut out: impl Write, slot: Slot, ostree_commit: &str) -> Result<()> {
417+
fn human_render_slot_ostree(
418+
mut out: impl Write,
419+
slot: Slot,
420+
entry: &crate::spec::BootEntry,
421+
ostree_commit: &str,
422+
) -> Result<()> {
415423
// TODO consider rendering more ostree stuff here like rpm-ostree status does
416424
let prefix = match slot {
417425
Slot::Staged => " Staged ostree".into(),
@@ -422,6 +430,7 @@ fn human_render_slot_ostree(mut out: impl Write, slot: Slot, ostree_commit: &str
422430
writeln!(out, "{prefix}")?;
423431
write_row_name(&mut out, "Commit", prefix_len)?;
424432
writeln!(out, "{ostree_commit}")?;
433+
tracing::debug!("pinned={}", entry.pinned);
425434
Ok(())
426435
}
427436

@@ -439,9 +448,9 @@ fn human_readable_output_booted(mut out: impl Write, host: &Host) -> Result<()>
439448
writeln!(out)?;
440449
}
441450
if let Some(image) = &host_status.image {
442-
human_render_slot(&mut out, slot_name, image)?;
451+
human_render_slot(&mut out, slot_name, host_status, image)?;
443452
} else if let Some(ostree) = host_status.ostree.as_ref() {
444-
human_render_slot_ostree(&mut out, slot_name, &ostree.checksum)?;
453+
human_render_slot_ostree(&mut out, slot_name, host_status, &ostree.checksum)?;
445454
} else {
446455
writeln!(out, "Current {slot_name} state is unknown")?;
447456
}

0 commit comments

Comments
 (0)