More stuff, lost a lot of progress to this shitty pc with a shitty os

This commit is contained in:
2026-08-20 16:22:35 +03:00
parent c7d2af0fd0
commit 3c904db36f
11 changed files with 319 additions and 15 deletions

View File

@@ -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) => {