From e99d4cd57bd1011dffadae123b07fcc470abce97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Sch=C3=B6chlin?= Date: Thu, 10 Jul 2025 13:01:39 +0200 Subject: [PATCH] Add a timeout --- src/execute.rs | 1 + src/parameters.rs | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/execute.rs b/src/execute.rs index fe3f03c..41740b8 100644 --- a/src/execute.rs +++ b/src/execute.rs @@ -87,6 +87,7 @@ fn establish_base_command(args: &CommandLineArgs, base_executable: &str, node: & if args.knownhostsaccept { cmd.args(["-o", "StrictHostKeyChecking=accept-new"]); } + cmd.args(["-o", &format!("ConnectTimeout={}", args.timeoutssh)]); return cmd; } diff --git a/src/parameters.rs b/src/parameters.rs index 5a1cd0d..4d79e09 100644 --- a/src/parameters.rs +++ b/src/parameters.rs @@ -128,6 +128,11 @@ pub struct CommandLineArgs { #[arg(short, long, default_value = "0")] pub(crate) wait: u64, + /// timeout for invoking ssh connections + #[arg(long, default_value = "3")] + pub(crate) timeoutssh: u8, + + /// ask after every execution, if hostctl should continue, retry, execute a shell or quit #[arg(short, long)] pub(crate) prompt: bool,