Skip to content
This repository was archived by the owner on Feb 24, 2023. It is now read-only.

Commit a732b17

Browse files
author
Leonidas Poulopoulos
committed
Merge branch 'subhak186-master'
2 parents b498be3 + 948685b commit a732b17

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

ncclient/manager.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,12 @@ def connect_ssh(*args, **kwds):
112112
session = transport.SSHSession(device_handler)
113113
session.load_known_hosts()
114114

115-
session.connect(*args, **kwds)
115+
try:
116+
session.connect(*args, **kwds)
117+
except Exception as ex:
118+
if session.transport:
119+
session.close()
120+
raise ex
116121
return Manager(session, device_handler, **kwds)
117122

118123
def connect_ioproc(*args, **kwds):

0 commit comments

Comments
 (0)