From be0a2bae8112de1d4674767c5c60e296c28e8532 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Tue, 21 Apr 2020 14:07:15 +0000 Subject: Add node tags in configuration --- src/main.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 9b75740d..01972928 100644 --- a/src/main.rs +++ b/src/main.rs @@ -111,6 +111,10 @@ pub struct ConfigureNodeOpt { /// Number of tokens n_tokens: u32, + + /// Optionnal node tag + #[structopt(long = "tag", default_value = "")] + tag: String, } #[derive(StructOpt, Debug)] @@ -266,8 +270,8 @@ async fn cmd_status(rpc_cli: RpcAddrClient, rpc_host: SocketAddr) -> Re for adv in status.iter() { if let Some(cfg) = config.members.get(&adv.id) { println!( - "{:?}\t{}\t{}\t{}\t{}", - adv.id, adv.state_info.hostname, adv.addr, cfg.datacenter, cfg.n_tokens + "{:?}\t{}\t{}\t{}\t{}\t{}", + adv.id, adv.state_info.hostname, adv.addr, cfg.tag, cfg.datacenter, cfg.n_tokens ); } } @@ -281,7 +285,10 @@ async fn cmd_status(rpc_cli: RpcAddrClient, rpc_host: SocketAddr) -> Re println!("\nFailed nodes:"); for (id, cfg) in config.members.iter() { if !status.iter().any(|x| x.id == *id) { - println!("{:?}\t{}\t{}", id, cfg.datacenter, cfg.n_tokens); + println!( + "{:?}\t{}\t{}\t{}", + id, cfg.tag, cfg.datacenter, cfg.n_tokens + ); } } } @@ -340,6 +347,7 @@ async fn cmd_configure( NetworkConfigEntry { datacenter: args.datacenter, n_tokens: args.n_tokens, + tag: args.tag, }, ); config.version += 1; -- cgit v1.2.3