def _connect(self, ssh):
if self.san_password:
ssh.connect(self.san_ip,
port=self.san_ssh_port,
username=self.san_login,
password=self.san_password,
timeout=self.ssh_conn_timeout)
elif self.san_privatekey:
pkfile = os.path.expanduser(self.san_privatekey)
privatekey = paramiko.RSAKey.from_private_key_file(pkfile)
ssh.connect(self.san_ip,
port=self.san_ssh_port,
username=self.san_login,
pkey=privatekey,
timeout=self.ssh_conn_timeout)
else:
msg = "Specify a password or private_key"
raise exceptions.SSHException(msg)
评论列表
文章目录