More stuff, lost a lot of progress to this shitty pc with a shitty os
This commit is contained in:
@@ -38,19 +38,24 @@ impl MtCommander {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn run_command_on_hosts(
|
||||
pub fn run_command_on_hosts(
|
||||
hosts: &[ConfigHost],
|
||||
command: &str,
|
||||
) -> anyhow::Result<HashMap<ConfigHost, anyhow::Result<Vec<HashMap<String, Option<String>>>>>>
|
||||
{
|
||||
let results = join_all(hosts.iter().map(|host| async move {
|
||||
let res = Self::run_command_on_host(host, command).await;
|
||||
(host.clone(), res)
|
||||
}))
|
||||
.await;
|
||||
) -> impl Future<
|
||||
Output = anyhow::Result<
|
||||
HashMap<ConfigHost, anyhow::Result<Vec<HashMap<String, Option<String>>>>>,
|
||||
>,
|
||||
> {
|
||||
async move {
|
||||
let results = join_all(hosts.iter().map(|host| async move {
|
||||
let res = Self::run_command_on_host(host, command).await;
|
||||
(host.clone(), res)
|
||||
}))
|
||||
.await;
|
||||
|
||||
let res_map: HashMap<_, _> = results.into_iter().collect();
|
||||
Ok(res_map)
|
||||
let res_map: HashMap<_, _> = results.into_iter().collect();
|
||||
Ok(res_map)
|
||||
}
|
||||
}
|
||||
pub async fn run_command_on_host(
|
||||
host: &ConfigHost,
|
||||
@@ -130,7 +135,7 @@ impl MtCommanderInternal {
|
||||
|
||||
let dev = match dev_res {
|
||||
Ok(dev) => {
|
||||
log::info!("({addr}) Connected successfully!");
|
||||
log::debug!("({addr}) Connected successfully!");
|
||||
dev
|
||||
}
|
||||
Err(e) => {
|
||||
|
||||
Reference in New Issue
Block a user