gerritssh.borrowed package

Submodules

gerritssh.borrowed.ssh module

Gerrit SSH Client.

A thin wrapper/extension of Paramiko’s SSHClient class, adding logic to parse the standard configuration file from ~/.ssh.

It also provides lightweight threading protection to allow a single connection to be used by multiple threads.

class gerritssh.borrowed.ssh.GerritSSHClient(hostname, username=None, port=None, keyfile_name=None)[source]

Bases: paramiko.client.SSHClient

Gerrit SSH Client, extending the paramiko SSH Client.

Parameters:
  • hostname – The host to connect to
  • username – The optional user name to use on connection
  • port – The optional port to use
  • keyfile_name – The optional key file to use
connected[source]

Does the client have an open conection?

Returns:True if the client is connected
disconnect()[source]

Close any open connection

Returns:self to allow chaining
execute(command)[source]

Run the given command.

Ensure we’re _connected to the remote server, and run command.

Returns:the results as an SSHCommandResult.
Raise:ValueError if command is not a string, or SSHException if command execution fails.
class gerritssh.borrowed.ssh.SSHCommandResult(command, stdin, stdout, stderr)[source]

Bases: object

Represents the results of a command run over SSH.

The three attributes are channels representing the three standard streams.

Parameters:
  • stdin – The channel’s input channel
  • stdout – Standard output channel
  • stderr – The error output channel

Module contents