Package qm :: Package test :: Package classes :: Module ssh_host :: Class SSHHost
[hide private]
[frames] | no frames]

Class SSHHost
source code

         object --+        
                  |        
extension.Extension --+    
                      |    
              host.Host --+
                          |
                         SSHHost
Known Subclasses:
RSHHost

An 'SSHHost' is accessible via 'ssh' or a similar program.

Nested Classes [hide private]

Inherited from host.Host: Executable

Inherited from extension.Extension: Type, __metaclass__


Instance Methods [hide private]
  Run(self, path, arguments, environment=None, timeout=-1, relative=False)
Run a program on the remote host.
  UploadFile(self, local_file, remote_file=None)
Copy 'local_file' to 'remote_file'.
  DownloadFile(self, remote_file, local_file=None)
Copy 'remote_file' to 'local_file'.
  DeleteFile(self, remote_file)
Delete the 'remote_file'.
  _FormSSHCommandLine(self, path, arguments, environment=None)
Form the 'ssh' command line.
  _FormSCPCommandLine(self, upload, local_file, remote_file)
Form the 'scp' command line.

Inherited from host.Host: UploadAndRun, __init__

Inherited from extension.Extension: GetClassName, GetExplicitArguments, MakeDomDocument, MakeDomElement, Write, __getattr__

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__


Class Variables [hide private]
host_name  
ssh_program  
ssh_args  
scp_program  
scp_args  
default_dir  
nfs_dir  
user_name  
_argument_dictionary A map from argument names to 'Field' instances.
_argument_list A list of all the 'Field's in this class.

Inherited from host.Host: kind

Inherited from extension.Extension: arguments

Inherited from object: __class__


Method Details [hide private]

Run(self, path, arguments, environment=None, timeout=-1, relative=False)

source code 

Run a program on the remote host.

'path' -- The name of the program to run, on the remote host. If 'relative' is true, or if 'path' is not an absolute path but does contain at least one directory separator, then 'path' is interpreted relative to the default directory. Otherwise, 'path' is used unmodified.

'arguments' -- The sequence of arguments that should be passed to the program.

'environment' -- If not 'None', a dictionary of pairs of strings to add to the environment of the running program.

'timeout' -- The number of seconds the program is permitted to execute. After the 'timeout' expires, the program will be terminated. However, in some cases (such as when using 'rsh') it will be the local side of the connection that is closed. The remote side of the connection may or may not continue to operate, depending on the vagaries of the remote operating system.

returns -- A pair '(status, output)'. The 'status' is the exit status returned by the program, or 'None' if the exit status is not available. The 'output' is a string giving the combined standard output and standard error output from the program.
Overrides: host.Host.Run
(inherited documentation)

UploadFile(self, local_file, remote_file=None)

source code 

Copy 'local_file' to 'remote_file'.

'local_file' -- The name of the file on the local machine.

'remote_file' -- The name of the file on the remote machine. The 'remote_file' must be a relative path. It is interpreted relative to the default directory. If 'None', the 'remote_file' is placed in the default directory using the basename of the 'local_file'.

If the 'local_file' and 'remote_file' are the same, then this function succeeds, but takes no action.
Overrides: host.Host.UploadFile
(inherited documentation)

DownloadFile(self, remote_file, local_file=None)

source code 

Copy 'remote_file' to 'local_file'.

'remote_file' -- The name of the file on the remote machine. The 'remote_file' must be a relative path. It is interpreted relative to the default directory.

'local_file' -- The name of the file on the local machine. If 'None', the 'local_file' is placed in the current directory using the basename of the 'remote_file'.

If the 'local_file' and 'remote_file' are the same, then this function succeeds, but takes no action.
Overrides: host.Host.DownloadFile
(inherited documentation)

DeleteFile(self, remote_file)

source code 

Delete the 'remote_file'.

'remote_file' -- A relative path to the file to be deleted.
Overrides: host.Host.DeleteFile
(inherited documentation)

_FormSSHCommandLine(self, path, arguments, environment=None)

source code 

Form the 'ssh' command line.

'path' -- The remote command, in the same format expected by 'Run'.

'arguments' -- The arguments to the remote command.

'environment' -- As for 'Run'.

returns -- A pair '(path, arguments)' describing the command to run on the local machine that will execute the remote command.

_FormSCPCommandLine(self, upload, local_file, remote_file)

source code 

Form the 'scp' command line.

'upload' -- True iff the 'local_file' should be copied to the remote host.

'local_file' -- The path to the local file.

'remote_file' -- The path to the remote file.

returns -- The list of arguments for a command to run on the local machine that will perform the file copy.

Class Variable Details [hide private]

host_name

Value:
''                                                                     
      

ssh_program

Value:
'ssh'                                                                  
      

ssh_args

Value:
[]                                                                     
      

scp_program

Value:
'scp'                                                                  
      

scp_args

Value:
[]                                                                     
      

default_dir

Value:
''                                                                     
      

nfs_dir

Value:
''                                                                     
      

user_name

Value:
''                                                                     
      

_argument_dictionary

A map from argument names to 'Field' instances.

A map from the names of arguments for this class to the corresponding 'Field'.
Value:
{'default_dir': <<class 'qm.fields.TextField'> default_dir>,
 'host_name': <<class 'qm.fields.TextField'> host_name>,
 'nfs_dir': <<class 'qm.fields.TextField'> nfs_dir>,
 'scp_args': <<class 'qm.fields.SetField'> scp_args>,
 'scp_program': <<class 'qm.fields.TextField'> scp_program>,
 'ssh_args': <<class 'qm.fields.SetField'> ssh_args>,
 'ssh_program': <<class 'qm.fields.TextField'> ssh_program>,
 'user_name': <<class 'qm.fields.TextField'> user_name>}               
      

_argument_list

A list of all the 'Field's in this class.

This list combines the complete list of 'arguments'. 'Field's appear in the order reached by a pre-order breadth-first traversal of the hierarchy, starting from the most derived class.
Value:
[<<class 'qm.fields.TextField'> scp_program>,
 <<class 'qm.fields.TextField'> default_dir>,
 <<class 'qm.fields.TextField'> ssh_program>,
 <<class 'qm.fields.TextField'> nfs_dir>,
 <<class 'qm.fields.TextField'> host_name>,
 <<class 'qm.fields.SetField'> scp_args>,
 <<class 'qm.fields.TextField'> user_name>,
 <<class 'qm.fields.SetField'> ssh_args>]