def test_ssh_tunnel_collection(sshd_manager): with sshd_manager.run(10) as sshd_ports: tunnel_args = { 'user': getpass.getuser(), 'key_path': sshd_manager.key_path, 'host_names': ['127.0.0.1:' + str(i) for i in sshd_ports]} with tunnel_collection(**tunnel_args) as tunnels: for t in tunnels: tunnel_write_and_run(t.write_to_remote, t.remote_cmd)
def test_ssh_tunnel_collection(sshd_manager): with sshd_manager.run(10) as sshd_ports: tunnel_args = { 'user': getpass.getuser(), 'key': sshd_manager.key, 'host_names': ['127.0.0.1:' + str(i) for i in sshd_ports]} with tunnel_collection(**tunnel_args) as tunnels: for t in tunnels: tunnel_write_and_run(t.write_to_remote, t.remote_cmd)
def tunnels(self, hosts): hostports = [host.public_ip + ':22' for host in hosts] with tunnel_collection(self.user, self.key, hostports) as tunnels: yield tunnels