Ignore:
Timestamp:
Dec 21, 2009, 1:11:31 AM (14 years ago)
Author:
broder
Message:

ajaxterm!

File:
1 edited

Legend:

Unmodified
Added
Removed
  • package_branches/invirt-web/ajaxterm-rebased/code/main.py

    r2751 r2752  
    406406                     hostname=cherrypy.request.local.name)
    407407            return d
     408
     409        @cherrypy.expose
     410        def at(self, machine_id, k=None, c=0):
     411            machine = validation.Validate(cherrypy.request.login, cherrypy.request.state, machine_id=machine_id).machine
     412            if machine_id in self.atsessions:
     413                term = self.atsessions[machine_id]
     414            else:
     415                print >>sys.stderr, "spawning new session for terminal to ",machine_id
     416                term = self.atsessions[machine_id] = self.atmulti.create(
     417                    ["ssh", "-e","none", "-l", machine.name, config.console.hostname]
     418                    )
     419            if k:
     420                self.atmulti.proc_write(term,k)
     421            time.sleep(0.002)
     422            dump=self.atmulti.dump(term,c)
     423            cherrypy.response.headers['Content-Type']='text/xml'
     424            if isinstance(dump,str):
     425                return dump
     426            else:
     427                del self.atsessions[machine_id]
     428                return '<?xml version="1.0"?><idem></idem>'
    408429
    409430    machine = MachineView()
Note: See TracChangeset for help on using the changeset viewer.