tardis.utilities.executors.sshexecutor module
- class tardis.utilities.executors.sshexecutor.ConnectionState(connection: SSHClientConnection, bound: Semaphore)[source]
Bases:
NamedTupleState associated with an active SSH connection
- bound: Semaphore
bound on concurrent sessions over the connection
- connection: SSHClientConnection
the SSH connection itself
- class tardis.utilities.executors.sshexecutor.DupingSSHExecutor(*, wrapper='/bin/bash', **parameters)[source]
Bases:
SSHExecutor
- class tardis.utilities.executors.sshexecutor.MFASSHClient(*args, mfa_config, **kwargs)[source]
Bases:
SSHClient- async kbdint_auth_requested() Union[str, None, Awaitable[Optional[str]]][source]
Keyboard-interactive authentication has been requested
This method should return a string containing a comma-separated list of submethods that the server should use for keyboard-interactive authentication. An empty string can be returned to let the server pick the type of keyboard-interactive authentication to perform.
- async kbdint_challenge_received(name: str, instructions: str, lang: str, prompts: Sequence[Tuple[str, bool]]) Union[Sequence[str], None, Awaitable[Optional[Sequence[str]]]][source]
A keyboard-interactive auth challenge has been received
This method is called when the server sends a keyboard-interactive authentication challenge.
The return value should be a list of strings of the same length as the number of prompts provided if the challenge can be answered, or None to indicate that some other form of authentication should be attempted.
- class tardis.utilities.executors.sshexecutor.SSHExecutor(*, on_disconnect_retry: int | bool = 3, **parameters)[source]
Bases:
ExecutorExecute shell commands via an SSH connection
This class provides several convenience features over a raw SSH connection:
Establishing a connection includes retries for temporary unavailability
An established connection is multiplexed for concurrent commands
Executing commands are used as feedback on the connection state
On connection failure both connection and commands are automatically retried
Notably, these features work in accord: Once a single command fails due to a broken connection, multiplexing means all commands are queued until the connection is reestablished. Retrying failed commands efficiently waits for the single connection to be retried.
- Parameters
on_disconnect_retry – Whether to retry commands if the connection is lost
- property bounded_connection
Get the current connection with a single reserved session slot
This is a context manager that guards the current
SSHClientConnectionso that only MaxSessions commands run at once.
- property lock
Lock protecting the connection