@@ -496,6 +496,32 @@ impl FromStr for MountSpec {
496
496
}
497
497
}
498
498
499
+ impl InstallAleph {
500
+ #[ context( "Creating aleph data" ) ]
501
+ pub ( crate ) fn new (
502
+ src_imageref : & ostree_container:: OstreeImageReference ,
503
+ imgstate : & ostree_container:: store:: LayeredImageState ,
504
+ selinux_state : & SELinuxFinalState ,
505
+ ) -> Result < Self > {
506
+ let uname = rustix:: system:: uname ( ) ;
507
+ let labels = crate :: status:: labels_of_config ( & imgstate. configuration ) ;
508
+ let timestamp = labels
509
+ . and_then ( |l| {
510
+ l. get ( oci_spec:: image:: ANNOTATION_CREATED )
511
+ . map ( |s| s. as_str ( ) )
512
+ } )
513
+ . and_then ( crate :: status:: try_deserialize_timestamp) ;
514
+ let r = InstallAleph {
515
+ image : src_imageref. imgref . name . clone ( ) ,
516
+ version : imgstate. version ( ) . as_ref ( ) . map ( |s| s. to_string ( ) ) ,
517
+ timestamp,
518
+ kernel : uname. release ( ) . to_str ( ) ?. to_string ( ) ,
519
+ selinux : selinux_state. to_aleph ( ) . to_string ( ) ,
520
+ } ;
521
+ Ok ( r)
522
+ }
523
+ }
524
+
499
525
impl SourceInfo {
500
526
// Inspect container information and convert it to an ostree image reference
501
527
// that pulls from containers-storage.
@@ -804,23 +830,7 @@ async fn install_container(
804
830
osconfig:: inject_root_ssh_authorized_keys ( & root, sepolicy, contents) ?;
805
831
}
806
832
807
- let uname = rustix:: system:: uname ( ) ;
808
-
809
- let labels = crate :: status:: labels_of_config ( & imgstate. configuration ) ;
810
- let timestamp = labels
811
- . and_then ( |l| {
812
- l. get ( oci_spec:: image:: ANNOTATION_CREATED )
813
- . map ( |s| s. as_str ( ) )
814
- } )
815
- . and_then ( crate :: status:: try_deserialize_timestamp) ;
816
- let aleph = InstallAleph {
817
- image : src_imageref. imgref . name . clone ( ) ,
818
- version : imgstate. version ( ) . as_ref ( ) . map ( |s| s. to_string ( ) ) ,
819
- timestamp,
820
- kernel : uname. release ( ) . to_str ( ) ?. to_string ( ) ,
821
- selinux : state. selinux_state . to_aleph ( ) . to_string ( ) ,
822
- } ;
823
-
833
+ let aleph = InstallAleph :: new ( & src_imageref, & imgstate, & state. selinux_state ) ?;
824
834
Ok ( ( deployment, aleph) )
825
835
}
826
836
0 commit comments