[PXCDD-commit] SF.net SVN: pxcdd: [396] trunk/client/pxcddup/sftp.py
Status: Alpha
Brought to you by:
tangentsoft
From: <tan...@us...> - 2006-07-12 11:20:57
|
Revision: 396 Author: tangentsoft Date: 2006-07-12 04:20:54 -0700 (Wed, 12 Jul 2006) ViewCVS: http://svn.sourceforge.net/pxcdd/?rev=396&view=rev Log Message: ----------- Deferred host key loading until first connect attempt, so the host key count message doesn't go to stdout when we're in GUI or .ddo mode. Output streams aren't redirected at that point yet. Modified Paths: -------------- trunk/client/pxcddup/sftp.py Modified: trunk/client/pxcddup/sftp.py =================================================================== --- trunk/client/pxcddup/sftp.py 2006-07-12 11:07:14 UTC (rev 395) +++ trunk/client/pxcddup/sftp.py 2006-07-12 11:20:54 UTC (rev 396) @@ -36,6 +36,7 @@ def __init__(self): self.filePickerGUI = False + self.hostKeys = None self.hostName = None self.localFiles = [] self.port = 22 @@ -47,9 +48,7 @@ self.userName = None self.modOnly = False - self.GetHostKeys() - def __str__(self): return 'sending files [%s] to %s@%s:%d/%s' % \ (', '.join(self.localFiles), self.userName, @@ -85,6 +84,8 @@ self.transport.start_client() # Check host key + if not self.hostKeys: + self.GetHostKeys() remoteKey = self.transport.get_remote_server_key() rfp = FingerprintStr(remoteKey) keys = self.hostKeys.lookup(self.hostName) @@ -244,11 +245,11 @@ if not os.path.exists(self.sshDir): os.mkdir(self.sshDir, 0700) - if self.hostKeys: - print 'SFTP: loaded', len(self.hostKeys.items()), \ - 'host keys' + numFound = len(self.hostKeys.items()) + if numFound: + print 'SFTP: loaded %d host keys' % numFound else: - print 'SFTP: no host keys found in', self.sshDir + print 'SFTP: no host keys found in %s' % self.sshDir def GetPassword(self): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |