def _get_transport_via_ip(self):
for i in range(60):
try:
channel = self._client.get_transport().open_channel(
'direct-tcpip',
(self._hostname, 22),
(self.via_ip, 0))
except ssh_exception.ChannelException:
LOG.debug('%s creating the direct-tcip connections' % self.description)
time.sleep(1)
else:
transport = paramiko.Transport(channel)
transport.start_client()
transport.auth_publickey(self._user, self._private_key)
return transport
raise Exception()
评论列表
文章目录