Back to index

obnam  1.1
Public Member Functions | Public Attributes
obnamlib.plugins.sftp_plugin.SSHChannelAdapter Class Reference

List of all members.

Public Member Functions

def __init__
def send
def recv
def get_name
def close

Public Attributes

 proc

Detailed Description

Take an ssh subprocess and pretend it is a paramiko Channel.

Definition at line 63 of file sftp_plugin.py.


Constructor & Destructor Documentation

Definition at line 69 of file sftp_plugin.py.

00069 
00070     def __init__(self, proc):
00071         self.proc = proc


Member Function Documentation

Definition at line 89 of file sftp_plugin.py.

00089 
00090     def close(self):
00091         logging.debug('SSHChannelAdapter.close called')
00092         for func in [self.proc.stdin.close, self.proc.stdout.close, 
00093                      self.proc.wait]:
00094             try:
00095                 func()
00096             except OSError:
00097                 pass
00098 

Definition at line 86 of file sftp_plugin.py.

00086 
00087     def get_name(self):
00088         return 'obnam SSHChannelAdapter'

Definition at line 75 of file sftp_plugin.py.

00075 
00076     def recv(self, count):
00077         try:
00078             return os.read(self.proc.stdout.fileno(), count)
00079         except socket.error, e:
00080             if e.args[0] in (errno.EPIPE, errno.ECONNRESET, errno.ECONNABORTED,
00081                              errno.EBADF):
00082                 # Connection has closed.  Paramiko expects an empty string in
00083                 # this case, not an exception.
00084                 return ''
00085             raise

Definition at line 72 of file sftp_plugin.py.

00072 
00073     def send(self, data):
00074         return os.write(self.proc.stdin.fileno(), data)


Member Data Documentation

Definition at line 70 of file sftp_plugin.py.


The documentation for this class was generated from the following file: