marvis.command_executor.ssh

Execute commands over SSH.

Functions

log_file

Classes

SSHCommandExecutor

The SSHCommandExecutor runs commands on a SSH remote host.


marvis.command_executor.ssh.log_file(logger, level, file, logfile)[source]
class marvis.command_executor.ssh.SSHCommandExecutor(name, client: paramiko.client.SSHClient, sudo=False)[source]

Bases: marvis.command_executor.base.CommandExecutor

The SSHCommandExecutor runs commands on a SSH remote host.

Parameters
  • name (str) – The name of the SSHCommandExecutor.

  • client – The SSH connection to use.

  • sudo (bool) – Indicates whether to run commands with sudo.

client

The SSH connection.

sudo

Indicates whether to run commands with sudo.

execute(command, user=None, shell=None, stdout_logfile=None, stderr_logfile=None)[source]

Execute a command.

Parameters
  • command (str) – The command to run.

  • user (str) – The user to run the command as.

  • shell (str) – The type of shell to use (sh, bash, …).

  • stdout_logfile (str) – The path to the log file to append the stdout output.

  • stderr_logfile (str) – The path to the log file to append the stderr output.

get_logger()

Retrieve the logger for this command executor.

name

The name of the CommandExecutor.

counter

A counter for loggers.

Inheritance Diagramm

Inheritance diagram of marvis.command_executor.ssh