Class SshConnectionManager
java.lang.Object
org.qubership.atp.environments.utils.jsch.SshConnectionManager
- All Implemented Interfaces:
Closeable,AutoCloseable
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidopen()Open SSH connection.runCommand(String command) <R> Optional<R> runCommand(String command, Collector<? super String, ?, R> collector) Preferred way to execute commands.voidsetSessionTimeout(int sessionTimeout)
-
Constructor Details
-
Method Details
-
open
public void open()Open SSH connection. -
setSessionTimeout
public void setSessionTimeout(int sessionTimeout) -
runCommand
-
runCommand
public <R> Optional<R> runCommand(String command, Collector<? super String, ?, throws TimeoutExceptionR> collector) Preferred way to execute commands. ! Uses 'bash -c ...' without '--login' option. ! May not work as expected since environment variables may differ from interactive mode.- Returns:
- command output. May not be present.
- Throws:
RuntimeException- if command executed with error.TimeoutException
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-