Revision: 88
Author: janne.t.harkonen
Date: Wed Nov 3 00:02:08 2010
Log: unused import, whitespace
http://code.google.com/p/robotframework-sshlibrary/source/detail?r=88
Modified:
/trunk/src/SSHLibrary/pythonclient.py
=======================================
--- /trunk/src/SSHLibrary/pythonclient.py Fri Feb 27 02:42:22 2009
+++ /trunk/src/SSHLibrary/pythonclient.py Wed Nov 3 00:02:08 2010
@@ -12,8 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-
-import os
import stat
import posixpath
@@ -28,7 +26,7 @@
def _monkey_patched_start_client(self, event=None):
self.banner_timeout = 45
self._orig_start_client(event)
-
+
paramiko.transport.Transport._orig_start_client =
paramiko.transport.Transport.start_client
paramiko.transport.Transport.start_client = _monkey_patched_start_client
@@ -36,20 +34,20 @@
class SSHClient(object):
enable_ssh_logging = staticmethod(lambda path:
paramiko.util.log_to_file(path))
-
+
def __init__(self, host, port=22):
self.client = paramiko.SSHClient()
self.client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
self.host = host
self.port = port
self.shell = None
-
+
def login(self, username, password):
self.client.connect(self.host, self.port, username, password)
-
+
def login_with_public_key(self, username, keyfile, password):
try:
- self.client.connect(self.host, self.port, username, password,
+ self.client.connect(self.host, self.port, username, password,
key_filename=keyfile)
except paramiko.AuthenticationException:
raise DataError()
@@ -73,10 +71,10 @@
if ret_mode.lower() == 'stderr':
return stderr.read()
return stdout.read()
-
+
def open_shell(self):
self.shell = self.client.invoke_shell()
-
+
def write(self, text):
self.shell.sendall(text)
@@ -94,10 +92,10 @@
def create_sftp_client(self):
self.sftp_client = self.client.open_sftp()
self.homedir = self.sftp_client.normalize('.') + '/'
-
+
def close_sftp_client(self):
self.sftp_client.close()
-
+
def create_missing_remote_path(self, path):
if path == '.':
return
@@ -110,13 +108,13 @@
print "*INFO* Creating missing remote directory '%s'" %
dirname
self.sftp_client.mkdir(dirname)
self.sftp_client.chdir(dirname)
-
+
def put_file(self, source, dest, mode):
self.sftp_client.put(source, dest)
self.sftp_client.chmod(dest, mode)
-
+
def listfiles(self, path):
- return[ getattr(fileinfo, 'filename', '?') for fileinfo
+ return[ getattr(fileinfo, 'filename', '?') for fileinfo
in self.sftp_client.listdir_attr(path)
if stat.S_ISREG(fileinfo.st_mode) or
stat.S_IFMT(fileinfo.st_mode) == 0 ]