Package pymeterlib :: Module SSHController :: Class SSHController
[show private | hide private]
[frames | no frames]

Class SSHController


Connect to remote host with SSH and issue commands.

This is a facade/wrapper that uses PySSH to spawn and control an SSH client. You must have OpenSSH installed.
Method Summary
  __init__(self, host_name, user_name, password, prompt)
  login(self)
Connect to a remote host and login.
  logout(self)
Close the connection to the remote host.
String run_atomic_command(self, command)
Connect to a remote host, login, run a command, and close the connection.
String run_command(self, command)
Run a command on the remote host.
String __strip_output(self, command, response)
Strip everything from the response except the actual command output.

Instance Variable Summary
  host_name: Host name or IP address
  password: Password
  prompt: Command prompt (or partial string matching the end of the prompt)
  ssh: Instance of a pyssh.Ssh object
  user_name: User name

Method Details

__init__(self, host_name, user_name, password, prompt)
(Constructor)

Parameters:
host_name - Host name or IP address
user_name - User name
password - Password
prompt - Command prompt (or partial string matching the end of the prompt)

login(self)

Connect to a remote host and login.

logout(self)

Close the connection to the remote host.

run_atomic_command(self, command)

Connect to a remote host, login, run a command, and close the connection.
Parameters:
command - Unix command
Returns:
Command output
           (type=String)

run_command(self, command)

Run a command on the remote host.
Parameters:
command - Unix command
Returns:
Command output
           (type=String)

__strip_output(self, command, response)

Strip everything from the response except the actual command output.
Parameters:
command - Unix command
response - Command output
Returns:
Stripped output
           (type=String)

Instance Variable Details

host_name

Host name or IP address

password

Password

prompt

Command prompt (or partial string matching the end of the prompt)

ssh

Instance of a pyssh.Ssh object

user_name

User name

Generated by Epydoc 2.1 on Fri Mar 17 09:16:19 2006 http://epydoc.sf.net