Change all exceptions to modern format (not Py2.5 compatible)
This commit is contained in:
parent
3ce336c88b
commit
25dd096da0
|
@ -113,8 +113,7 @@ if hostname.find(':') >= 0:
|
|||
try:
|
||||
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
sock.connect((hostname, port))
|
||||
except Exception:
|
||||
e = sys.exc_info()[1]
|
||||
except Exception as e:
|
||||
print('*** Connect failed: ' + str(e))
|
||||
traceback.print_exc()
|
||||
sys.exit(1)
|
||||
|
@ -171,8 +170,7 @@ try:
|
|||
chan.close()
|
||||
t.close()
|
||||
|
||||
except Exception:
|
||||
e = sys.exc_info()[1]
|
||||
except Exception as e:
|
||||
print('*** Caught exception: ' + str(e.__class__) + ': ' + str(e))
|
||||
traceback.print_exc()
|
||||
try:
|
||||
|
|
|
@ -84,8 +84,7 @@ try:
|
|||
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
||||
sock.bind(('', 2200))
|
||||
except Exception:
|
||||
e = sys.exc_info()[1]
|
||||
except Exception as e:
|
||||
print('*** Bind failed: ' + str(e))
|
||||
traceback.print_exc()
|
||||
sys.exit(1)
|
||||
|
@ -94,8 +93,7 @@ try:
|
|||
sock.listen(100)
|
||||
print('Listening for connection ...')
|
||||
client, addr = sock.accept()
|
||||
except Exception:
|
||||
e = sys.exc_info()[1]
|
||||
except Exception as e:
|
||||
print('*** Listen/accept failed: ' + str(e))
|
||||
traceback.print_exc()
|
||||
sys.exit(1)
|
||||
|
@ -138,8 +136,7 @@ try:
|
|||
chan.send('\r\nI don\'t like you, ' + username + '.\r\n')
|
||||
chan.close()
|
||||
|
||||
except Exception:
|
||||
e = sys.exc_info()[1]
|
||||
except Exception as e:
|
||||
print('*** Caught exception: ' + str(e.__class__) + ': ' + str(e))
|
||||
traceback.print_exc()
|
||||
try:
|
||||
|
|
|
@ -114,8 +114,7 @@ try:
|
|||
|
||||
t.close()
|
||||
|
||||
except Exception:
|
||||
e = sys.exc_info()[1]
|
||||
except Exception as e:
|
||||
print('*** Caught exception: %s: %s' % (e.__class__, e))
|
||||
traceback.print_exc()
|
||||
try:
|
||||
|
|
|
@ -77,8 +77,7 @@ try:
|
|||
chan.close()
|
||||
client.close()
|
||||
|
||||
except Exception:
|
||||
e = sys.exc_info()[1]
|
||||
except Exception as e:
|
||||
print('*** Caught exception: %s: %s' % (e.__class__, e))
|
||||
traceback.print_exc()
|
||||
try:
|
||||
|
|
|
@ -58,8 +58,7 @@ class Handler (SocketServer.BaseRequestHandler):
|
|||
chan = self.ssh_transport.open_channel('direct-tcpip',
|
||||
(self.chain_host, self.chain_port),
|
||||
self.request.getpeername())
|
||||
except Exception:
|
||||
e = sys.exc_info()[1]
|
||||
except Exception as e:
|
||||
verbose('Incoming request to %s:%d failed: %s' % (self.chain_host,
|
||||
self.chain_port,
|
||||
repr(e)))
|
||||
|
@ -170,8 +169,7 @@ def main():
|
|||
try:
|
||||
client.connect(server[0], server[1], username=options.user, key_filename=options.keyfile,
|
||||
look_for_keys=options.look_for_keys, password=password)
|
||||
except Exception:
|
||||
e = sys.exc_info()[1]
|
||||
except Exception as e:
|
||||
print('*** Failed to connect to %s:%d: %r' % (server[0], server[1], e))
|
||||
sys.exit(1)
|
||||
|
||||
|
|
|
@ -46,8 +46,7 @@ def handler(chan, host, port):
|
|||
sock = socket.socket()
|
||||
try:
|
||||
sock.connect((host, port))
|
||||
except Exception:
|
||||
e = sys.exc_info()[1]
|
||||
except Exception as e:
|
||||
verbose('Forwarding request to %s:%d failed: %r' % (host, port, e))
|
||||
return
|
||||
|
||||
|
@ -151,8 +150,7 @@ def main():
|
|||
try:
|
||||
client.connect(server[0], server[1], username=options.user, key_filename=options.keyfile,
|
||||
look_for_keys=options.look_for_keys, password=password)
|
||||
except Exception:
|
||||
e = sys.exc_info()[1]
|
||||
except Exception as e:
|
||||
print('*** Failed to connect to %s:%d: %r' % (server[0], server[1], e))
|
||||
sys.exit(1)
|
||||
|
||||
|
|
|
@ -306,8 +306,7 @@ class AuthHandler (object):
|
|||
keyblob = m.get_binary()
|
||||
try:
|
||||
key = self.transport._key_info[keytype](Message(keyblob))
|
||||
except SSHException:
|
||||
e = sys.exc_info()[1]
|
||||
except SSHException as e:
|
||||
self.transport._log(INFO, 'Auth rejected: public key: %s' % str(e))
|
||||
key = None
|
||||
except:
|
||||
|
|
|
@ -452,8 +452,8 @@ class SSHClient (object):
|
|||
two_factor = (allowed_types == ['password'])
|
||||
if not two_factor:
|
||||
return
|
||||
except SSHException:
|
||||
saved_exception = sys.exc_info()[1]
|
||||
except SSHException as e:
|
||||
saved_exception = e
|
||||
|
||||
if not two_factor:
|
||||
for key_filename in key_filenames:
|
||||
|
@ -466,8 +466,8 @@ class SSHClient (object):
|
|||
if not two_factor:
|
||||
return
|
||||
break
|
||||
except SSHException:
|
||||
saved_exception = sys.exc_info()[1]
|
||||
except SSHException as e:
|
||||
saved_exception = e
|
||||
|
||||
if not two_factor and allow_agent:
|
||||
if self._agent == None:
|
||||
|
@ -482,8 +482,8 @@ class SSHClient (object):
|
|||
if not two_factor:
|
||||
return
|
||||
break
|
||||
except SSHException:
|
||||
saved_exception = sys.exc_info()[1]
|
||||
except SSHException as e:
|
||||
saved_exception = e
|
||||
|
||||
if not two_factor:
|
||||
keyfiles = []
|
||||
|
@ -514,8 +514,8 @@ class SSHClient (object):
|
|||
if not two_factor:
|
||||
return
|
||||
break
|
||||
except (SSHException, IOError):
|
||||
saved_exception = sys.exc_info()[1]
|
||||
except (SSHException, IOError) as e:
|
||||
saved_exception = e
|
||||
|
||||
if password is not None:
|
||||
try:
|
||||
|
|
|
@ -187,8 +187,8 @@ class DSSKey (PKey):
|
|||
# DSAPrivateKey = { version = 0, p, q, g, y, x }
|
||||
try:
|
||||
keylist = BER(data).decode()
|
||||
except BERException:
|
||||
raise SSHException('Unable to parse key file: ' + str(sys.exc_info()[1]))
|
||||
except BERException as e:
|
||||
raise SSHException('Unable to parse key file: ' + str(e))
|
||||
if (type(keylist) is not list) or (len(keylist) < 6) or (keylist[0] != 0):
|
||||
raise SSHException('not a valid DSA private key file (bad ber encoding)')
|
||||
self.p = keylist[1]
|
||||
|
|
|
@ -92,7 +92,7 @@ class HostKeyEntry:
|
|||
log.info("Unable to handle key of type %s" % (keytype,))
|
||||
return None
|
||||
|
||||
except binascii.Error:
|
||||
except binascii.Error as e:
|
||||
raise InvalidHostKey(line, sys.exc_info()[1])
|
||||
|
||||
return cls(names, key)
|
||||
|
|
|
@ -216,8 +216,7 @@ class Packetizer (object):
|
|||
n -= len(x)
|
||||
except socket.timeout:
|
||||
got_timeout = True
|
||||
except socket.error:
|
||||
e = sys.exc_info()[1]
|
||||
except socket.error as e:
|
||||
# on Linux, sometimes instead of socket.timeout, we get
|
||||
# EAGAIN. this is a bug in recent (> 2.6.9) kernels but
|
||||
# we need to work around it.
|
||||
|
@ -246,8 +245,7 @@ class Packetizer (object):
|
|||
n = self.__socket.send(out)
|
||||
except socket.timeout:
|
||||
retry_write = True
|
||||
except socket.error:
|
||||
e = sys.exc_info()[1]
|
||||
except socket.error as e:
|
||||
if (type(e.args) is tuple) and (len(e.args) > 0) and (e.args[0] == errno.EAGAIN):
|
||||
retry_write = True
|
||||
elif (type(e.args) is tuple) and (len(e.args) > 0) and (e.args[0] == errno.EINTR):
|
||||
|
@ -472,8 +470,7 @@ class Packetizer (object):
|
|||
break
|
||||
except socket.timeout:
|
||||
pass
|
||||
except EnvironmentError:
|
||||
e = sys.exc_info()[1]
|
||||
except EnvironmentError as e:
|
||||
if ((type(e.args) is tuple) and (len(e.args) > 0) and
|
||||
(e.args[0] == errno.EINTR)):
|
||||
pass
|
||||
|
|
|
@ -312,8 +312,8 @@ class PKey (object):
|
|||
# if we trudged to the end of the file, just try to cope.
|
||||
try:
|
||||
data = decodebytes(b(''.join(lines[start:end])))
|
||||
except base64.binascii.Error:
|
||||
raise SSHException('base64 decoding error: ' + str(sys.exc_info()[1]))
|
||||
except base64.binascii.Error as e:
|
||||
raise SSHException('base64 decoding error: ' + str(e))
|
||||
if 'proc-type' not in headers:
|
||||
# unencryped: done
|
||||
return data
|
||||
|
|
|
@ -60,8 +60,7 @@ class ProxyCommand(object):
|
|||
"""
|
||||
try:
|
||||
self.process.stdin.write(content)
|
||||
except IOError:
|
||||
e = sys.exc_info()[1]
|
||||
except IOError as e:
|
||||
# There was a problem with the child process. It probably
|
||||
# died and we can't proceed. The best option here is to
|
||||
# raise an exception informing the user that the informed
|
||||
|
@ -81,8 +80,7 @@ class ProxyCommand(object):
|
|||
"""
|
||||
try:
|
||||
return os.read(self.process.stdout.fileno(), size)
|
||||
except IOError:
|
||||
e = sys.exc_info()[1]
|
||||
except IOError as e:
|
||||
raise ProxyCommandFailure(' '.join(self.cmd), e.strerror)
|
||||
|
||||
def close(self):
|
||||
|
|
|
@ -623,8 +623,7 @@ class SubsystemHandler (threading.Thread):
|
|||
try:
|
||||
self.__transport._log(DEBUG, 'Starting handler for subsystem %s' % self.__name)
|
||||
self.start_subsystem(self.__name, self.__transport, self.__channel)
|
||||
except Exception:
|
||||
e = sys.exc_info()[1]
|
||||
except Exception as e:
|
||||
self.__transport._log(ERROR, 'Exception in subsystem handler for "%s": %s' %
|
||||
(self.__name, str(e)))
|
||||
self.__transport._log(ERROR, util.tb_strings())
|
||||
|
|
|
@ -717,8 +717,8 @@ class SFTPClient (BaseSFTP):
|
|||
while True:
|
||||
try:
|
||||
t, data = self._read_packet()
|
||||
except EOFError:
|
||||
raise SSHException('Server connection dropped: %s' % str(sys.exc_info()[1]))
|
||||
except EOFError as e:
|
||||
raise SSHException('Server connection dropped: %s' % str(e))
|
||||
msg = Message(data)
|
||||
num = msg.get_int()
|
||||
if num not in self._expecting:
|
||||
|
|
|
@ -464,8 +464,8 @@ class SFTPFile (BufferedFile):
|
|||
# save exception and re-raise it on next file operation
|
||||
try:
|
||||
self.sftp._convert_status(msg)
|
||||
except Exception:
|
||||
self._saved_exception = sys.exc_info()[1]
|
||||
except Exception as e:
|
||||
self._saved_exception = e
|
||||
return
|
||||
if t != CMD_DATA:
|
||||
raise SFTPError('Expected data')
|
||||
|
|
|
@ -100,8 +100,7 @@ class SFTPHandle (object):
|
|||
readfile.seek(offset)
|
||||
self.__tell = offset
|
||||
data = readfile.read(length)
|
||||
except IOError:
|
||||
e = sys.exc_info()[1]
|
||||
except IOError as e:
|
||||
self.__tell = None
|
||||
return SFTPServer.convert_errno(e.errno)
|
||||
self.__tell += len(data)
|
||||
|
@ -140,8 +139,7 @@ class SFTPHandle (object):
|
|||
self.__tell = offset
|
||||
writefile.write(data)
|
||||
writefile.flush()
|
||||
except IOError:
|
||||
e = sys.exc_info()[1]
|
||||
except IOError as e:
|
||||
self.__tell = None
|
||||
return SFTPServer.convert_errno(e.errno)
|
||||
if self.__tell is not None:
|
||||
|
|
|
@ -92,8 +92,7 @@ class SFTPServer (BaseSFTP, SubsystemHandler):
|
|||
except EOFError:
|
||||
self._log(DEBUG, 'EOF -- end of session')
|
||||
return
|
||||
except Exception:
|
||||
e = sys.exc_info()[1]
|
||||
except Exception as e:
|
||||
self._log(DEBUG, 'Exception on channel: ' + str(e))
|
||||
self._log(DEBUG, util.tb_strings())
|
||||
return
|
||||
|
@ -101,8 +100,7 @@ class SFTPServer (BaseSFTP, SubsystemHandler):
|
|||
request_number = msg.get_int()
|
||||
try:
|
||||
self._process(t, request_number, msg)
|
||||
except Exception:
|
||||
e = sys.exc_info()[1]
|
||||
except Exception as e:
|
||||
self._log(DEBUG, 'Exception in server processing: ' + str(e))
|
||||
self._log(DEBUG, util.tb_strings())
|
||||
# send some kind of failure message, at least
|
||||
|
|
|
@ -295,8 +295,8 @@ class Transport (threading.Thread):
|
|||
sock = socket.socket(af, socket.SOCK_STREAM)
|
||||
try:
|
||||
retry_on_signal(lambda: sock.connect((hostname, port)))
|
||||
except socket.error:
|
||||
reason = str(sys.exc_info()[1])
|
||||
except socket.error as e:
|
||||
reason = str(e)
|
||||
else:
|
||||
break
|
||||
else:
|
||||
|
@ -1184,10 +1184,9 @@ class Transport (threading.Thread):
|
|||
return []
|
||||
try:
|
||||
return self.auth_handler.wait_for_response(my_event)
|
||||
except BadAuthenticationType:
|
||||
x = sys.exc_info()[1]
|
||||
except BadAuthenticationType as e:
|
||||
# if password auth isn't allowed, but keyboard-interactive *is*, try to fudge it
|
||||
if not fallback or ('keyboard-interactive' not in x.allowed_types):
|
||||
if not fallback or ('keyboard-interactive' not in e.allowed_types):
|
||||
raise
|
||||
try:
|
||||
def handler(title, instructions, fields):
|
||||
|
@ -1203,7 +1202,7 @@ class Transport (threading.Thread):
|
|||
return self.auth_interactive(username, handler)
|
||||
except SSHException:
|
||||
# attempt failed; just raise the original exception
|
||||
raise x
|
||||
raise e
|
||||
return None
|
||||
|
||||
def auth_publickey(self, username, key, event=None):
|
||||
|
@ -1608,26 +1607,22 @@ class Transport (threading.Thread):
|
|||
msg.add_byte(cMSG_UNIMPLEMENTED)
|
||||
msg.add_int(m.seqno)
|
||||
self._send_message(msg)
|
||||
except SSHException:
|
||||
e = sys.exc_info()[1]
|
||||
except SSHException as e:
|
||||
self._log(ERROR, 'Exception: ' + str(e))
|
||||
self._log(ERROR, util.tb_strings())
|
||||
self.saved_exception = e
|
||||
except EOFError:
|
||||
e = sys.exc_info()[1]
|
||||
except EOFError as e:
|
||||
self._log(DEBUG, 'EOF in transport thread')
|
||||
#self._log(DEBUG, util.tb_strings())
|
||||
self.saved_exception = e
|
||||
except socket.error:
|
||||
e = sys.exc_info()[1]
|
||||
except socket.error as e:
|
||||
if type(e.args) is tuple:
|
||||
emsg = '%s (%d)' % (e.args[1], e.args[0])
|
||||
else:
|
||||
emsg = e.args
|
||||
self._log(ERROR, 'Socket exception: ' + emsg)
|
||||
self.saved_exception = e
|
||||
except Exception:
|
||||
e = sys.exc_info()[1]
|
||||
except Exception as e:
|
||||
self._log(ERROR, 'Unknown exception: ' + str(e))
|
||||
self._log(ERROR, util.tb_strings())
|
||||
self.saved_exception = e
|
||||
|
@ -1687,9 +1682,8 @@ class Transport (threading.Thread):
|
|||
buf = self.packetizer.readline(timeout)
|
||||
except ProxyCommandFailure:
|
||||
raise
|
||||
except Exception:
|
||||
x = sys.exc_info()[1]
|
||||
raise SSHException('Error reading SSH protocol banner' + str(x))
|
||||
except Exception as e:
|
||||
raise SSHException('Error reading SSH protocol banner' + str(e))
|
||||
if buf[:4] == 'SSH-':
|
||||
break
|
||||
self._log(DEBUG, 'Banner: ' + buf)
|
||||
|
|
|
@ -272,8 +272,7 @@ def retry_on_signal(function):
|
|||
while True:
|
||||
try:
|
||||
return function()
|
||||
except EnvironmentError:
|
||||
e = sys.exc_info()[1]
|
||||
except EnvironmentError as e:
|
||||
if e.errno != errno.EINTR:
|
||||
raise
|
||||
|
||||
|
|
|
@ -40,8 +40,7 @@ class StubSFTPHandle (SFTPHandle):
|
|||
def stat(self):
|
||||
try:
|
||||
return SFTPAttributes.from_stat(os.fstat(self.readfile.fileno()))
|
||||
except OSError:
|
||||
e = sys.exc_info()[1]
|
||||
except OSError as e:
|
||||
return SFTPServer.convert_errno(e.errno)
|
||||
|
||||
def chattr(self, attr):
|
||||
|
@ -50,8 +49,7 @@ class StubSFTPHandle (SFTPHandle):
|
|||
try:
|
||||
SFTPServer.set_file_attr(self.filename, attr)
|
||||
return SFTP_OK
|
||||
except OSError:
|
||||
e = sys.exc_info()[1]
|
||||
except OSError as e:
|
||||
return SFTPServer.convert_errno(e.errno)
|
||||
|
||||
|
||||
|
@ -73,24 +71,21 @@ class StubSFTPServer (SFTPServerInterface):
|
|||
attr.filename = fname
|
||||
out.append(attr)
|
||||
return out
|
||||
except OSError:
|
||||
e = sys.exc_info()[1]
|
||||
except OSError as e:
|
||||
return SFTPServer.convert_errno(e.errno)
|
||||
|
||||
def stat(self, path):
|
||||
path = self._realpath(path)
|
||||
try:
|
||||
return SFTPAttributes.from_stat(os.stat(path))
|
||||
except OSError:
|
||||
e = sys.exc_info()[1]
|
||||
except OSError as e:
|
||||
return SFTPServer.convert_errno(e.errno)
|
||||
|
||||
def lstat(self, path):
|
||||
path = self._realpath(path)
|
||||
try:
|
||||
return SFTPAttributes.from_stat(os.lstat(path))
|
||||
except OSError:
|
||||
e = sys.exc_info()[1]
|
||||
except OSError as e:
|
||||
return SFTPServer.convert_errno(e.errno)
|
||||
|
||||
def open(self, path, flags, attr):
|
||||
|
@ -105,8 +100,7 @@ class StubSFTPServer (SFTPServerInterface):
|
|||
# os.open() defaults to 0777 which is
|
||||
# an odd default mode for files
|
||||
fd = os.open(path, flags, o666)
|
||||
except OSError:
|
||||
e = sys.exc_info()[1]
|
||||
except OSError as e:
|
||||
return SFTPServer.convert_errno(e.errno)
|
||||
if (flags & os.O_CREAT) and (attr is not None):
|
||||
attr._flags &= ~attr.FLAG_PERMISSIONS
|
||||
|
@ -126,8 +120,7 @@ class StubSFTPServer (SFTPServerInterface):
|
|||
fstr = 'rb'
|
||||
try:
|
||||
f = os.fdopen(fd, fstr)
|
||||
except OSError:
|
||||
e = sys.exc_info()[1]
|
||||
except OSError as e:
|
||||
return SFTPServer.convert_errno(e.errno)
|
||||
fobj = StubSFTPHandle(flags)
|
||||
fobj.filename = path
|
||||
|
@ -139,8 +132,7 @@ class StubSFTPServer (SFTPServerInterface):
|
|||
path = self._realpath(path)
|
||||
try:
|
||||
os.remove(path)
|
||||
except OSError:
|
||||
e = sys.exc_info()[1]
|
||||
except OSError as e:
|
||||
return SFTPServer.convert_errno(e.errno)
|
||||
return SFTP_OK
|
||||
|
||||
|
@ -149,8 +141,7 @@ class StubSFTPServer (SFTPServerInterface):
|
|||
newpath = self._realpath(newpath)
|
||||
try:
|
||||
os.rename(oldpath, newpath)
|
||||
except OSError:
|
||||
e = sys.exc_info()[1]
|
||||
except OSError as e:
|
||||
return SFTPServer.convert_errno(e.errno)
|
||||
return SFTP_OK
|
||||
|
||||
|
@ -160,8 +151,7 @@ class StubSFTPServer (SFTPServerInterface):
|
|||
os.mkdir(path)
|
||||
if attr is not None:
|
||||
SFTPServer.set_file_attr(path, attr)
|
||||
except OSError:
|
||||
e = sys.exc_info()[1]
|
||||
except OSError as e:
|
||||
return SFTPServer.convert_errno(e.errno)
|
||||
return SFTP_OK
|
||||
|
||||
|
@ -169,8 +159,7 @@ class StubSFTPServer (SFTPServerInterface):
|
|||
path = self._realpath(path)
|
||||
try:
|
||||
os.rmdir(path)
|
||||
except OSError:
|
||||
e = sys.exc_info()[1]
|
||||
except OSError as e:
|
||||
return SFTPServer.convert_errno(e.errno)
|
||||
return SFTP_OK
|
||||
|
||||
|
@ -178,8 +167,7 @@ class StubSFTPServer (SFTPServerInterface):
|
|||
path = self._realpath(path)
|
||||
try:
|
||||
SFTPServer.set_file_attr(path, attr)
|
||||
except OSError:
|
||||
e = sys.exc_info()[1]
|
||||
except OSError as e:
|
||||
return SFTPServer.convert_errno(e.errno)
|
||||
return SFTP_OK
|
||||
|
||||
|
@ -199,8 +187,7 @@ class StubSFTPServer (SFTPServerInterface):
|
|||
target_path = '<error>'
|
||||
try:
|
||||
os.symlink(target_path, path)
|
||||
except OSError:
|
||||
e = sys.exc_info()[1]
|
||||
except OSError as e:
|
||||
return SFTPServer.convert_errno(e.errno)
|
||||
return SFTP_OK
|
||||
|
||||
|
@ -208,8 +195,7 @@ class StubSFTPServer (SFTPServerInterface):
|
|||
path = self._realpath(path)
|
||||
try:
|
||||
symlink = os.readlink(path)
|
||||
except OSError:
|
||||
e = sys.exc_info()[1]
|
||||
except OSError as e:
|
||||
return SFTPServer.convert_errno(e.errno)
|
||||
# if it's absolute, remove the root
|
||||
if os.path.isabs(symlink):
|
||||
|
|
|
@ -650,8 +650,7 @@ class SFTPTest (unittest.TestCase):
|
|||
try:
|
||||
sftp.rename(FOLDER + '/something', FOLDER + '/' + unicode_folder)
|
||||
sftp.open(b(FOLDER) + utf8_folder, 'r')
|
||||
except Exception:
|
||||
e = sys.exc_info()[1]
|
||||
except Exception as e:
|
||||
self.fail('exception ' + str(e))
|
||||
sftp.unlink(b(FOLDER) + utf8_folder)
|
||||
|
||||
|
|
|
@ -302,9 +302,8 @@ class TransportTest(ParamikoTest):
|
|||
try:
|
||||
chan = self.tc.open_channel('bogus')
|
||||
self.fail('expected exception')
|
||||
except ChannelException:
|
||||
x = sys.exc_info()[1]
|
||||
self.assertTrue(x.code == OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED)
|
||||
except ChannelException as e:
|
||||
self.assertTrue(e.code == OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED)
|
||||
|
||||
def test_9_exit_status(self):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue