Пример #1
0
def servidores_aula():
    if not auth.user: redirect(URL(c='default',f='index'))

    l=conecta()
    t = Thinclients(l,"","","","")
    computers1 = t.getAllComputersNode("group1")    
    computers2 = t.getAllComputersNode("group2")
    computers3 = t.getAllComputersNode("group3")
    computers4 = t.getAllComputersNode("group4")
    
    all = computers1["computers"]+computers2["computers"]+computers3["computers"]+computers4["computers"]
    for c in all:
        t2 = Thinclients(l,c,"","","")
        response = t2.move(c)
    
    l.close()

    c = SSHConnection("localhost","root","")
    response = c.connectWithoutPass("/var/web2py/applications/controlies/.ssh/id_rsa")
    if response != True:
        return dict()

    c.exec_command("if ! pgrep ssh-agent ; then eval $(ssh-agent -s); fi")
    #c.exec_command("ssh-add /var/web2py/applications/controlies/.ssh/id_rsa")
    c.close()
    return dict()
Пример #2
0
def servidores_aula():
    if not auth.user: redirect(URL(c='default', f='index'))

    l = conecta()
    t = Thinclients(l, "", "", "", "")
    computers1 = t.getAllComputersNode("group1")
    computers2 = t.getAllComputersNode("group2")
    computers3 = t.getAllComputersNode("group3")
    computers4 = t.getAllComputersNode("group4")

    all = computers1["computers"] + computers2["computers"] + computers3[
        "computers"] + computers4["computers"]
    for c in all:
        t2 = Thinclients(l, c, "", "", "")
        response = t2.move(c)

    l.close()

    c = SSHConnection("localhost", "root", "")
    response = c.connectWithoutPass(
        "/var/web2py/applications/controlies/.ssh/id_rsa")
    if response != True:
        return dict()

    c.exec_command("if ! pgrep ssh-agent ; then eval $(ssh-agent -s); fi")
    #c.exec_command("ssh-add /var/web2py/applications/controlies/.ssh/id_rsa")
    c.close()
    return dict()
Пример #3
0
def getLaptopsPupils():
    try:
        classroom = request.vars['classroom'].split("-")
        l=conecta()
        t = Thinclients(l,"","","","")
        computers = t.getAllComputersNode(classroom[0])
        response = computers["computers"]
    except:
        response=[]    

    return dict(response=response)
Пример #4
0
def getLaptopsPupils():
    try:
        classroom = request.vars['classroom'].split("-")
        l = conecta()
        t = Thinclients(l, "", "", "", "")
        computers = t.getAllComputersNode(classroom[0])
        response = computers["computers"]
    except:
        response = []

    return dict(response=response)
Пример #5
0
def getComputersNode():
    l=conecta()
    t = Thinclients(l)
    computers = t.getAllComputersNode(request.vars['node'])
    return dict(response=sorted(computers["computers"]))