summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwillmcgugan <willmcgugan@67cdc799-7952-0410-af00-57a81ceafa0f>2010-12-19 00:55:29 +0000
committerwillmcgugan <willmcgugan@67cdc799-7952-0410-af00-57a81ceafa0f>2010-12-19 00:55:29 +0000
commite24d7a4ad91eea5b6740f1de3b6f1bb22495bc7a (patch)
tree7db2daf075c7f61fba0a9c049da28deb487a4a5f
parentb6c21954970a8206465822cd03d09c81ae4967b5 (diff)
downloadpyfilesystem-git-e24d7a4ad91eea5b6740f1de3b6f1bb22495bc7a.tar.gz
Tweaks. Going to bed now. Hope I haven't frakked up the tests
-rw-r--r--fs/sftpfs.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/fs/sftpfs.py b/fs/sftpfs.py
index e54869d..32bade2 100644
--- a/fs/sftpfs.py
+++ b/fs/sftpfs.py
@@ -141,7 +141,7 @@ class SFTPFS(FS):
except paramiko.SSHException:
pass
- if not connection.is_authenticated():
+ elif not connection.is_authenticated():
if not username:
username = getuser()
try:
@@ -151,23 +151,23 @@ class SFTPFS(FS):
if not connection.is_authenticated() and password:
connection.auth_password(username, password)
- if agent_auth and not connection.is_authenticated():
+ if agent_auth and not connection.is_authenticated():
self._agent_auth(connection, username)
if not connection.is_authenticated():
try:
connection.auth_none(username)
except paramiko.BadAuthenticationType, e:
- connection.close()
+ self.close()
allowed = ', '.join(e.allowed_types)
raise RemoteConnectionError(msg='no auth - server requires one of the following: %s' % allowed, details=e)
- if not connection.is_authenticated():
- connection.close()
+ if not connection.is_authenticated():
+ self.close()
raise RemoteConnectionError(msg='no auth')
- except paramiko.SSHException, e:
- connection.close()
+ except paramiko.SSHException, e:
+ self.close()
raise RemoteConnectionError(msg='SSH exception (%s)' % str(e), details=e)
self._transport = connection