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 {
535
535
l. get ( oci_spec:: image:: ANNOTATION_CREATED )
536
536
. map ( |s| s. as_str ( ) )
537
537
} )
538
- . and_then ( crate :: status :: try_deserialize_timestamp) ;
538
+ . and_then ( bootc_utils :: try_deserialize_timestamp) ;
539
539
let r = InstallAleph {
540
540
image : src_imageref. imgref . name . clone ( ) ,
541
541
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 {
102
102
pub ( crate ) other : VecDeque < ostree:: Deployment > ,
103
103
}
104
104
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
-
115
105
pub ( crate ) fn labels_of_config (
116
106
config : & oci_spec:: image:: ImageConfiguration ,
117
107
) -> 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 ;
2
2
3
3
use ostree_ext:: container as ostree_container;
4
4
use ostree_ext:: oci_spec;
@@ -52,7 +52,7 @@ fn create_imagestatus(
52
52
. map ( |s| s. as_str ( ) )
53
53
} )
54
54
. or_else ( || config. created ( ) . as_deref ( ) )
55
- . and_then ( try_deserialize_timestamp) ;
55
+ . and_then ( bootc_utils :: try_deserialize_timestamp) ;
56
56
57
57
let version = ostree_container:: version_for_config ( config) . map ( ToOwned :: to_owned) ;
58
58
let architecture = config. architecture ( ) . to_string ( ) ;
@@ -70,13 +70,3 @@ fn labels_of_config(
70
70
) -> Option < & std:: collections:: HashMap < String , String > > {
71
71
config. config ( ) . as_ref ( ) . and_then ( |c| c. labels ( ) . as_ref ( ) )
72
72
}
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"
8
8
9
9
[dependencies ]
10
10
anyhow = { workspace = true }
11
+ chrono = { workspace = true , features = [" std" ] }
11
12
rustix = { workspace = true }
12
13
serde = { workspace = true , features = [" derive" ] }
13
14
serde_json = { workspace = true }
Original file line number Diff line number Diff line change @@ -8,5 +8,7 @@ mod path;
8
8
pub use path:: * ;
9
9
mod iterators;
10
10
pub use iterators:: * ;
11
+ mod timestamp;
12
+ pub use timestamp:: * ;
11
13
mod tracing_util;
12
14
pub 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