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

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.
source code
 
UploadFile(self, local_file, remote_file=None)
Copy 'local_file' to 'remote_file'.
source code
 
DownloadFile(self, remote_file, local_file=None)
Copy 'remote_file' to 'local_file'.
source code
 
DeleteFile(self, remote_file)
Delete the 'remote_file'.
source code
 
_FormSSHCommandLine(self, path, arguments, environment=None)
Form the 'ssh' command line.
source code
 
_FormSCPCommandLine(self, upload, local_file, remote_file)
Form the 'scp' command line.
source code

Inherited from host.Host: UploadAndRun, __init__

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

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

Class Variables [hide private]
  host_name = TextField()
  ssh_program = TextField(default_value= "ssh", description= """...
  ssh_args = SetField(TextField(description= """The arguments to...
  scp_program = TextField(default_value= "scp", description= """...
  scp_args = SetField(TextField(description= """The arguments to...
  default_dir = TextField(description= """The default directory ...
  nfs_dir = TextField(description= """The default directory, as ...
  user_name = TextField(description= """The user name on the rem...

Inherited from host.Host: kind

Inherited from extension.Extension: arguments

Properties [hide private]

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]

ssh_program

Value:
TextField(default_value= "ssh", description= """The path to the remote\
 shell program.""")

ssh_args

Value:
SetField(TextField(description= """The arguments to the remote shell p\
rogram."""))

scp_program

Value:
TextField(default_value= "scp", description= """The path to the remote\
 copy program.""")

scp_args

Value:
SetField(TextField(description= """The arguments to the remote copy pr\
ogram."""))

default_dir

Value:
TextField(description= """The default directory on the remote system."\
"")

nfs_dir

Value:
TextField(description= """The default directory, as seen from the loca\
l host.
    
        If not empty, 'nfs_dir' is a directory on the local machine
        that is equivalent to the default directory on the remote
        machine.  In that case, files will be copied to and from this
        directory on the local machine, rather than by using
        'scp'.""")

user_name

Value:
TextField(description= """The user name on the remote host.

        If not empty, the user name that should be used when
        connecting to the remote host.""")