@@ -364,8 +364,7 @@ fn human_render_ostree(mut out: impl Write, slot_name: &str, _ostree_commit: &st
364
364
Ok ( ( ) )
365
365
}
366
366
367
- /// Implementation of rendering our host structure in a "human readable" way.
368
- fn human_readable_output ( mut out : impl Write , host : & Host ) -> Result < ( ) > {
367
+ fn human_readable_output_booted ( mut out : impl Write , host : & Host ) -> Result < ( ) > {
369
368
for ( slot_name, status) in [
370
369
( "staged" , & host. status . staged ) ,
371
370
( "booted" , & host. status . booted ) ,
@@ -386,6 +385,16 @@ fn human_readable_output(mut out: impl Write, host: &Host) -> Result<()> {
386
385
Ok ( ( ) )
387
386
}
388
387
388
+ /// Implementation of rendering our host structure in a "human readable" way.
389
+ fn human_readable_output ( mut out : impl Write , host : & Host ) -> Result < ( ) > {
390
+ if host. status . booted . is_some ( ) {
391
+ human_readable_output_booted ( out, host) ?;
392
+ } else {
393
+ writeln ! ( out, "System is not deployed via bootc." ) ?;
394
+ }
395
+ Ok ( ( ) )
396
+ }
397
+
389
398
#[ cfg( test) ]
390
399
mod tests {
391
400
use super :: * ;
@@ -465,15 +474,7 @@ mod tests {
465
474
// staged/rollback image, no booted
466
475
let w = human_status_from_spec_fixture ( include_str ! ( "fixtures/spec-staged-rollback.yaml" ) )
467
476
. expect ( "No spec found" ) ;
468
- let expected = indoc:: indoc! { r"
469
- Current staged image: quay.io/example/someimage:latest
470
- Image version: nightly (2023-10-14 19:22:15 UTC)
471
- Image digest: sha256:16dc2b6256b4ff0d2ec18d2dbfb06d117904010c8cf9732cdb022818cf7a7566
472
- No booted image present
473
- Current rollback image: quay.io/example/someimage:latest
474
- Image version: nightly (2023-09-30 19:22:16 UTC)
475
- Image digest: sha256:736b359467c9437c1ac915acaae952aad854e07eb4a16a94999a48af08c83c34
476
- " } ;
477
+ let expected = "System is not deployed via bootc.\n " ;
477
478
similar_asserts:: assert_eq!( w, expected) ;
478
479
}
479
480
0 commit comments