Fix some error handling

This commit is contained in:
Alexandr Bogomyakov
2023-08-02 16:29:37 +03:00
parent c635ed0dd0
commit 5ed62d9323
2 changed files with 7 additions and 3 deletions

2
Cargo.lock generated
View File

@ -1043,7 +1043,7 @@ checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78"
[[package]]
name = "rexec"
version = "1.0.3"
version = "1.0.4"
dependencies = [
"brace-expand",
"clap 4.3.4",

View File

@ -24,13 +24,13 @@ struct Args {
#[arg(short, long, default_value_t = whoami::username())]
username: String,
#[arg(short, long, help = "Use known_hosts to build servers list")]
#[arg(short, long, help = "Use known_hosts to build servers list instead of string expansion.")]
known_hosts: bool,
#[arg(
short,
long,
help = "Expression to build server list. List and range expansion available. Example: 'web-[1:12]-io-{prod,dev}'"
help = "Expression to build server list. List and range expansion are supported. Example: 'web-[1:12]-io-{prod,dev}'"
)]
expression: String,
@ -171,6 +171,10 @@ fn main() {
// Build MasshHostConfig hostnames list
let mut massh_hosts: Vec<MasshHostConfig> = vec![];
let mut hosts_and_ips: HashMap<IpAddr, String> = HashMap::new();
if args.parallel != 100 {
warn!("Parallelism: {} thread{}", &args.parallel, {if args.parallel != 1 {"s."} else {"."}});
}
info!("Matched hosts:");
for host in matched_hosts.iter() {
let ip = match lookup_host(&host.name) {