File tree Expand file tree Collapse file tree 7 files changed +20
-23
lines changed Expand file tree Collapse file tree 7 files changed +20
-23
lines changed Original file line number Diff line number Diff line change @@ -535,7 +535,7 @@ impl InstallAleph {
535535 l. get ( oci_spec:: image:: ANNOTATION_CREATED )
536536 . map ( |s| s. as_str ( ) )
537537 } )
538- . and_then ( crate :: status :: try_deserialize_timestamp) ;
538+ . and_then ( bootc_utils :: try_deserialize_timestamp) ;
539539 let r = InstallAleph {
540540 image : src_imageref. imgref . name . clone ( ) ,
541541 version : imgstate. version ( ) . as_ref ( ) . map ( |s| s. to_string ( ) ) ,
Original file line number Diff line number Diff line change @@ -102,16 +102,6 @@ pub(crate) struct Deployments {
102102 pub ( crate ) other : VecDeque < ostree:: Deployment > ,
103103}
104104
105- pub ( crate ) fn try_deserialize_timestamp ( t : & str ) -> Option < chrono:: DateTime < chrono:: Utc > > {
106- match chrono:: DateTime :: parse_from_rfc3339 ( t) . context ( "Parsing timestamp" ) {
107- Ok ( t) => Some ( t. into ( ) ) ,
108- Err ( e) => {
109- tracing:: warn!( "Invalid timestamp in image: {:#}" , e) ;
110- None
111- }
112- }
113- }
114-
115105pub ( crate ) fn labels_of_config (
116106 config : & oci_spec:: image:: ImageConfiguration ,
117107) -> Option < & std:: collections:: HashMap < String , String > > {
Original file line number Diff line number Diff line change 1- use anyhow:: { Context , Result } ;
1+ use anyhow:: Result ;
22
33use ostree_ext:: container as ostree_container;
44use ostree_ext:: oci_spec;
@@ -52,7 +52,7 @@ fn create_imagestatus(
5252 . map ( |s| s. as_str ( ) )
5353 } )
5454 . or_else ( || config. created ( ) . as_deref ( ) )
55- . and_then ( try_deserialize_timestamp) ;
55+ . and_then ( bootc_utils :: try_deserialize_timestamp) ;
5656
5757 let version = ostree_container:: version_for_config ( config) . map ( ToOwned :: to_owned) ;
5858 let architecture = config. architecture ( ) . to_string ( ) ;
@@ -70,13 +70,3 @@ fn labels_of_config(
7070) -> Option < & std:: collections:: HashMap < String , String > > {
7171 config. config ( ) . as_ref ( ) . and_then ( |c| c. labels ( ) . as_ref ( ) )
7272}
73-
74- fn try_deserialize_timestamp ( t : & str ) -> Option < chrono:: DateTime < chrono:: Utc > > {
75- match chrono:: DateTime :: parse_from_rfc3339 ( t) . context ( "Parsing timestamp" ) {
76- Ok ( t) => Some ( t. into ( ) ) ,
77- Err ( e) => {
78- tracing:: warn!( "Invalid timestamp in image: {:#}" , e) ;
79- None
80- }
81- }
82- }
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ repository = "https://github.com/bootc-dev/bootc"
88
99[dependencies ]
1010anyhow = { workspace = true }
11+ chrono = { workspace = true }
1112rustix = { workspace = true }
1213serde = { workspace = true , features = [" derive" ] }
1314serde_json = { workspace = true }
Original file line number Diff line number Diff line change @@ -8,5 +8,7 @@ mod path;
88pub use path:: * ;
99mod iterators;
1010pub use iterators:: * ;
11+ mod timestamp;
12+ pub use timestamp:: * ;
1113mod tracing_util;
1214pub use tracing_util:: * ;
Original file line number Diff line number Diff line change 1+ use anyhow:: Context ;
2+ use chrono;
3+
4+ /// Try to parse an RFC 3339, warn on error.
5+ pub fn try_deserialize_timestamp ( t : & str ) -> Option < chrono:: DateTime < chrono:: Utc > > {
6+ match chrono:: DateTime :: parse_from_rfc3339 ( t) . context ( "Parsing timestamp" ) {
7+ Ok ( t) => Some ( t. into ( ) ) ,
8+ Err ( e) => {
9+ tracing:: warn!( "Invalid timestamp in image: {:#}" , e) ;
10+ None
11+ }
12+ }
13+ }
You can’t perform that action at this time.
0 commit comments