Skip to content

Commit

Permalink
Output the IDs of endpoints and container images (endpoint subcommand)
Browse files Browse the repository at this point in the history
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 <michael.weiss@eviden.com>
  • Loading branch information
primeos-work committed Apr 30, 2024
1 parent 1ff6af9 commit 0cc56e3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/commands/endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ async fn stats(
"Name",
"Containers",
"Images",
"Id",
"Kernel",
"Memory",
"Memory limit",
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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,
]
Expand Down

0 comments on commit 0cc56e3

Please sign in to comment.