@@ -11,7 +11,7 @@ use crate::{
1111 boot:: BootType ,
1212 repo:: get_imgref,
1313 selinux:: are_selinux_policies_compatible,
14- state:: get_composefs_usr_overlay_status,
14+ state:: { get_composefs_usr_overlay_status, read_origin } ,
1515 utils:: { compute_store_boot_digest_for_uki, get_uki_cmdline} ,
1616 } ,
1717 composefs_consts:: {
@@ -699,11 +699,6 @@ async fn composefs_deployment_status_from(
699699 // This is our source of truth
700700 let bootloader_entry_verity = list_bootloader_entries ( storage) ?;
701701
702- let state_dir = storage
703- . physical_root
704- . open_dir ( STATE_DIR_RELATIVE )
705- . with_context ( || format ! ( "Opening {STATE_DIR_RELATIVE}" ) ) ?;
706-
707702 let host_spec = HostSpec {
708703 image : None ,
709704 boot_order : BootOrder :: Default ,
@@ -732,15 +727,8 @@ async fn composefs_deployment_status_from(
732727 let mut extra_deployment_boot_entries: Vec < BootEntry > = Vec :: new ( ) ;
733728
734729 for verity_digest in bootloader_entry_verity {
735- // read the origin file
736- let config = state_dir
737- . open_dir ( & verity_digest)
738- . with_context ( || format ! ( "Failed to open {verity_digest}" ) ) ?
739- . read_to_string ( format ! ( "{verity_digest}.origin" ) )
740- . with_context ( || format ! ( "Reading file {verity_digest}.origin" ) ) ?;
741-
742- let ini = tini:: Ini :: from_string ( & config)
743- . with_context ( || format ! ( "Failed to parse file {verity_digest}.origin as ini" ) ) ?;
730+ let ini = read_origin ( & storage. physical_root , & verity_digest) ?
731+ . ok_or_else ( || anyhow:: anyhow!( "No origin file for deployment {verity_digest}" ) ) ?;
744732
745733 let mut boot_entry =
746734 boot_entry_from_composefs_deployment ( storage, ini, & verity_digest) . await ?;
0 commit comments