@@ -284,26 +284,31 @@ async fn upgrade(opts: UpgradeOpts) -> Result<()> {
284
284
prepare_for_write ( ) . await ?;
285
285
let sysroot = & get_locked_sysroot ( ) . await ?;
286
286
let repo = & sysroot. repo ( ) ;
287
- let booted_deployment = & sysroot. require_booted_deployment ( ) ?;
288
- let ( _deployments, host) = crate :: status:: get_status ( sysroot, Some ( booted_deployment) ) ?;
289
- // SAFETY: There must be a status if we have a booted deployment
290
- let status = host. status . unwrap ( ) ;
287
+ let ( booted_deployment, _deployments, host) =
288
+ crate :: status:: get_status_require_booted ( sysroot) ?;
291
289
let imgref = host. spec . image . as_ref ( ) ;
292
290
// If there's no specified image, let's be nice and check if the booted system is using rpm-ostree
293
- if imgref. is_none ( ) && status. booted . as_ref ( ) . map_or ( false , |b| b. incompatible ) {
291
+ if imgref. is_none ( )
292
+ && host
293
+ . status
294
+ . booted
295
+ . as_ref ( )
296
+ . map_or ( false , |b| b. incompatible )
297
+ {
294
298
return Err ( anyhow:: anyhow!(
295
299
"Booted deployment contains local rpm-ostree modifications; cannot upgrade via bootc"
296
300
) ) ;
297
301
}
298
302
let spec = RequiredHostSpec :: from_spec ( & host. spec ) ?;
299
- let booted_image = status
303
+ let booted_image = host
304
+ . status
300
305
. booted
301
306
. map ( |b| b. query_image ( repo) )
302
307
. transpose ( ) ?
303
308
. flatten ( ) ;
304
309
let imgref = imgref. ok_or_else ( || anyhow:: anyhow!( "No image source specified" ) ) ?;
305
310
// Find the currently queued digest, if any before we pull
306
- let staged = status. staged . as_ref ( ) ;
311
+ let staged = host . status . staged . as_ref ( ) ;
307
312
let staged_image = staged. as_ref ( ) . and_then ( |s| s. image . as_ref ( ) ) ;
308
313
let mut changed = false ;
309
314
if opts. check {
@@ -365,8 +370,8 @@ async fn switch(opts: SwitchOpts) -> Result<()> {
365
370
366
371
let sysroot = & get_locked_sysroot ( ) . await ?;
367
372
let repo = & sysroot. repo ( ) ;
368
- let booted_deployment = & sysroot . require_booted_deployment ( ) ? ;
369
- let ( _deployments , host ) = crate :: status:: get_status ( sysroot, Some ( booted_deployment ) ) ?;
373
+ let ( booted_deployment, _deployments , host ) =
374
+ crate :: status:: get_status_require_booted ( sysroot) ?;
370
375
371
376
let transport = ostree_container:: Transport :: try_from ( opts. transport . as_str ( ) ) ?;
372
377
let imgref = ostree_container:: ImageReference {
@@ -419,9 +424,8 @@ async fn edit(opts: EditOpts) -> Result<()> {
419
424
prepare_for_write ( ) . await ?;
420
425
let sysroot = & get_locked_sysroot ( ) . await ?;
421
426
let repo = & sysroot. repo ( ) ;
422
- let booted_deployment = & sysroot. require_booted_deployment ( ) ?;
423
- let ( _deployments, host) = crate :: status:: get_status ( sysroot, Some ( booted_deployment) ) ?;
424
-
427
+ let ( booted_deployment, _deployments, host) =
428
+ crate :: status:: get_status_require_booted ( sysroot) ?;
425
429
let new_host: Host = if opts. filename == "-" {
426
430
let tmpf = tempfile:: NamedTempFile :: new ( ) ?;
427
431
serde_yaml:: to_writer ( std:: io:: BufWriter :: new ( tmpf. as_file ( ) ) , & host) ?;
0 commit comments