fluidasserts.helper.ssh module

SSH helper.

This module enables connections via SSH.

class fluidasserts.helper.ssh.AutoAddHostPolicy

Bases: object

Policy for automatically adding the hostname and new host key.

Inspired on paramiko

missing_host_key(client, hostname, key)

Method called when there is no missing host key in the client.

exception fluidasserts.helper.ssh.ConnError

Bases: Exception

A connection error occurred.

paramiko.ssh_exception.AuthenticationException wrapper exception.

fluidasserts.helper.ssh.build_ssh_object()

Build a Paramiko SSHClient object.

Return type

Generator[SSHClient, None, None]

fluidasserts.helper.ssh.ssh_exec_command(server, username, password, command, config_file=None)

Connect using SSH and execute specific command.

Parameters
  • server (str) – URL or IP of host to test.

  • username (str) – User to connect to server.

  • password (str) – Password for given user.

  • command (str) – Command to execute in SSH Session.

  • config_file (Optional[str]) – Path to SSH connection config file.

Return type

Tuple[bool, bool]

fluidasserts.helper.ssh.ssh_user_pass(server, username, password, command)

Connect using SSH username and password and execute given command.

Parameters
  • server (str) – URL or IP of host to test.

  • username (str) – User to connect to server.

  • password (str) – Password for given user.

  • command (str) – Command to execute in SSH Session.

Return type

Tuple[bool, bool]

fluidasserts.helper.ssh.ssh_with_config(server, username, config_file, command)

Connect using SSH configuration file and execute given command.

Parameters
  • server (str) – URL or IP of host to test.

  • username (str) – User to connect to server.

  • config_file (str) – Path to SSH connection config file.

  • command (str) – Command to execute in SSH Session.

Return type

Tuple[bool, bool]