From 0cc56e3568731160ba37be9c1a26b7367f5c07f8 Mon Sep 17 00:00:00 2001 From: Michael Weiss Date: Tue, 30 Apr 2024 16:07:59 +0200 Subject: [PATCH] Output the IDs of endpoints and container images (endpoint subcommand) This is basically a quickfix for our `cargo check` CI test against the beta toolchain that reported that those two fields don't need `pub` as they're never accessed from outside the module. Alternatives would be to drop `pub` or add an `#[allow(dead_code)]` exception but outputting the IDs might actually be for the best (they're normally not that relevant but could be useful, e.g., when interacting with the DB). The main problem is that the `butido endpoint containers list` output becomes too wide and the IDs get truncated but ideally we'd try to shorten the IDs anyway (the only problem is ensuring that they remain locally unique...). Signed-off-by: Michael Weiss --- src/commands/endpoint.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/commands/endpoint.rs b/src/commands/endpoint.rs index 000bd310..c02a5386 100644 --- a/src/commands/endpoint.rs +++ b/src/commands/endpoint.rs @@ -140,6 +140,7 @@ async fn stats( "Name", "Containers", "Images", + "Id", "Kernel", "Memory", "Memory limit", @@ -173,6 +174,7 @@ async fn stats( stat.name, stat.containers.to_string(), stat.images.to_string(), + stat.id.to_string(), stat.kernel_version, bytesize::ByteSize::b(stat.mem_total).to_string(), stat.memory_limit.to_string(), @@ -213,7 +215,7 @@ async fn containers_list( let newer_than_filter = crate::commands::util::get_date_filter("newer_than", matches)?; let csv = matches.get_flag("csv"); let hdr = crate::commands::util::mk_header( - ["Endpoint", "Container id", "Image", "Created", "Status"].to_vec(), + ["Endpoint", "Container id", "Image", "Image id", "Created", "Status"].to_vec(), ); let data = connect_to_endpoints(config, &endpoint_names) @@ -247,10 +249,12 @@ async fn containers_list( .unwrap_or(true) }) .map(|stat| { + // TODO: The output can become too wide (we should, e.g., try to shorten the IDs): vec![ endpoint_name.as_ref().to_owned(), stat.id, stat.image, + stat.image_id, stat.created.to_string(), stat.status, ]