caviar.network.ssh

SSH module.

exception caviar.network.ssh.SSHUnavailableSessionError(target)

Bases: BaseException

target
exception caviar.network.ssh.SSHInvalidSessionError(target)

Bases: BaseException

target
exception caviar.network.ssh.SSHCommandError(target, cause_lines)

Bases: BaseException

target
cause_lines
class caviar.network.ssh.SSHSessionFactory(ssh_client, private_key_path)

Bases: object

SSH session factory.

session(user, host, attempt_count=5, attempt_timeout=1)
close()
class caviar.network.ssh.SSHSession(pool, target, attempt_count, attempt_timeout)

Bases: object

SSH logic session.

Parameters:
  • pool (SSHSessionPool) – Session pool.
  • target (SSHUserHost) – Session target.
  • attempt_count (int) – Session availability attempt count.
  • attempt_timeout (int) – Session availability attempt timeout.
execute(cmd)

Execute the specified command.

Parameters:

cmd (str) – Command to be executed.

Return type:

iter

Returns:

Iterator of standard output lines.

Raises:
class caviar.network.ssh.SSHSessionPool(ssh_client, private_key_path)

Bases: object

get(target)
discard(target)
close()
class caviar.network.ssh.SSHUserHost(user, host)

Bases: object

user
host