SshShell io: subsequent open or close does nothing besides logging
@@ -86,6 +86,7 @@ class SshShell(object):
Should allow for using as context manager: with connection.open():
"""
+ if self.shell_channel is None:
self._debug('connecting to {}'.format(self))
transport = self.ssh_client.get_transport()
@@ -139,6 +140,7 @@ class SshShell(object):
Connection should allow for calling close on closed/not-open connection.
"""
+ if self.shell_channel is not None:
self._debug('closing {}'.format(self))
self._close()
@@ -162,7 +164,6 @@ class SshShell(object):
def __enter__(self):
"""While working as context manager connection should auto-open if it's not open yet."""
- if self.shell_channel is None:
self.open()
return self
