def newlog(self, proxy_ssh, hostid, username): # 有新终端连接,初始化终端日志 user = User.objects.get(username=username) sshlog = SSH_Log.objects.create(host_id=hostid, user=user, type=2) cache.set('proxy_ssh_%d' % sshlog.id, 1, timeout=self.timeout) self.sshs[sshlog.id] = proxy_ssh return sshlog
def set_elfinder(self, hostid, optinon_sets): if hostid not in self.elfinder_sftps: self.elfinder_sftps[hostid] = ElfinderConnector(optinon_sets) cache.set('elfinder_%s' % hostid, 1, timeout=self.sftp_timeout) return self.elfinder_sftps[hostid]