Fix display bug in garage status (nothing to do with k2v)
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing

This commit is contained in:
Alex 2022-04-15 16:43:57 +02:00
parent 7cdec31e10
commit fe4a8e85be
Signed by: lx
GPG key ID: 0E496D15096376BE

View file

@ -85,13 +85,14 @@ pub async fn cmd_status(rpc_cli: &Endpoint<SystemRpc, ()>, rpc_host: NodeID) ->
format_table(healthy_nodes); format_table(healthy_nodes);
let status_keys = status.iter().map(|adv| adv.id).collect::<HashSet<_>>(); let status_keys = status.iter().map(|adv| adv.id).collect::<HashSet<_>>();
let failure_case_1 = status.iter().any(|adv| !adv.is_up); let failure_case_1 = status
.iter()
.any(|adv| !adv.is_up && matches!(layout.roles.get(&adv.id), Some(NodeRoleV(Some(_)))));
let failure_case_2 = layout let failure_case_2 = layout
.roles .roles
.items() .items()
.iter() .iter()
.filter(|(_, _, v)| v.0.is_some()) .any(|(id, _, v)| !status_keys.contains(id) && v.0.is_some());
.any(|(id, _, _)| !status_keys.contains(id));
if failure_case_1 || failure_case_2 { if failure_case_1 || failure_case_2 {
println!("\n==== FAILED NODES ===="); println!("\n==== FAILED NODES ====");
let mut failed_nodes = let mut failed_nodes =