def ssh_client(**kwargs): """Context manager that returns an SSH client. The SSH connection is opened before entering, and closed before leaving. """ client = SSHClient(**kwargs) if not client.connect(): raise Exception("Cannot create SSH connection with %s" % (client,)) try: yield client finally: client.close()
def ssh_client(**kwargs): """Context manager that returns an SSH client. The SSH connection is opened before entering, and closed before leaving. """ client = SSHClient(**kwargs) if not client.connect(): raise Exception("Cannot create SSH connection with %s" % (client, )) try: yield client finally: client.close()
def test_close_success(self): client = ShellOutSSHClient(hostname='localhost', username='******') self.assertTrue(client.close())
def test_close_success(self): client = ShellOutSSHClient(hostname='localhost', username='******') self.assertTrue(client.close())