def thread(self,model,queue,cmd=None,
cmd_args=None,localPath=None,
remotePath=None,remoteFile=None):
if model == 'command':
self.sshConn = paramiko.SSHClient()
self.sshConn.set_missing_host_key_policy(paramiko.AutoAddPolicy())
self.sshConn.connect(hostname = self.hostname,port=self.port,
username=self.username, password=self.password)
self.threads = SSH(ssh=self.sshConn,hostname=self.hostname,
queue=queue,model=model,cmd=cmd,
cmd_args=cmd_args,localPath=localPath,
remotePath=remotePath,remoteFile=remoteFile)
elif model in ['upload','download']:
self.sshConn = paramiko.Transport((self.hostname,self.port))
self.sshConn.connect(username=self.username, password=self.password)
self.threads = SSH(ssh=self.sshConn,hostname=self.hostname,
queue=queue,model=model,cmd=cmd,
cmd_args=cmd_args,localPath=localPath,
remotePath=remotePath,remoteFile=remoteFile)
评论列表
文章目录