Implement basic version of ssh shell

Signed-off-by: Vladimir Domnich <v.domnich@yadro.com>
This commit is contained in:
Vladimir Domnich 2022-08-24 15:41:11 +04:00 committed by anastasia prasolova
parent f6ee129354
commit d3e5ee2231
16 changed files with 525 additions and 92 deletions

View file

@ -11,6 +11,7 @@ class InteractiveInput:
:attr str prompt_pattern: regular expression that defines expected prompt from the command.
:attr str input: user input that should be supplied to the command in response to the prompt.
"""
prompt_pattern: str
input: str
@ -21,11 +22,12 @@ class CommandOptions:
Options that control command execution.
:attr list interactive_inputs: user inputs that should be interactively supplied to
the command during its' execution.
the command during execution.
:attr int timeout: timeout for command execution (in seconds).
:attr bool check: controls whether to check return code of the command. Set to False to
ignore non-zero return codes.
"""
interactive_inputs: Optional[list[InteractiveInput]] = None
timeout: int = 30
check: bool = True
@ -36,6 +38,7 @@ class CommandResult:
"""
Represents a result of a command executed via shell.
"""
stdout: str
stderr: str
return_code: int
@ -56,4 +59,3 @@ class Shell(ABC):
:param CommandOptions options: options that control command execution.
:return command result.
"""
pass