mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Set a connect timeout on the ssh command
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
This commit is contained in:
parent
abd51f2a04
commit
8542fa1606
1 changed files with 10 additions and 1 deletions
11
tools/vm.py
11
tools/vm.py
|
@ -646,7 +646,13 @@ class VM:
|
|||
stderr = None
|
||||
proc = subprocess.Popen(
|
||||
self.ssh_command_args(
|
||||
"exit", "0", log_command_level=logging.DEBUG
|
||||
"exit",
|
||||
"0",
|
||||
log_command_level=logging.DEBUG,
|
||||
ssh_options=[
|
||||
"-oConnectTimeout=5",
|
||||
"-oConnectionAttempts=1",
|
||||
],
|
||||
),
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
|
@ -972,6 +978,7 @@ class VM:
|
|||
pseudo_terminal: bool = False,
|
||||
env: list[str] = None,
|
||||
log_command_level: int = logging.INFO,
|
||||
ssh_options: list[str] | None = None,
|
||||
) -> list[str]:
|
||||
ssh = shutil.which("ssh")
|
||||
if TYPE_CHECKING:
|
||||
|
@ -982,6 +989,8 @@ class VM:
|
|||
"-F",
|
||||
str(self.ssh_config_file.relative_to(REPO_ROOT)),
|
||||
]
|
||||
if ssh_options:
|
||||
_ssh_command_args.extend(ssh_options)
|
||||
if pseudo_terminal is True:
|
||||
_ssh_command_args.append("-t")
|
||||
if include_vm_target:
|
||||
|
|
Loading…
Add table
Reference in a new issue