Show
Ignore:
Timestamp:
02/20/12 10:26:03 (3 years ago)
Author:
edent
Message:

run nodeBooter

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • ossiedev/branches/jsnyder/trunk/tools/cornetApps/DomainMan/views.py

    r11024 r11025  
    88    return render_to_response('DomainMan/cornet_login.html', locals(), context_instance=RequestContext(request)) 
    99 
    10 def console_page(request, ip, port, user, password): 
     10def connect(request, ip, port, user, password): 
    1111    client = SSHClient() 
    1212    client.set_missing_host_key_policy(AutoAddPolicy()) 
    13     client.connect(ip, port, user, password) 
     13    client.connect(ip, int(port), user, password) 
     14    return client 
     15 
     16def nodeBooter_running(client): 
    1417    stdin, stdout, stderr = client.exec_command('ps x | grep nodeBooter') 
    1518    processes = stdout.readlines() 
    16     runningNodebooter = 'dev/nodes/' in processes 
     19    for proc in processes: 
     20        if 'dev/nodes' in proc and 'DeviceManager.dcd' in proc: 
     21            runningNodebooter = 1 
     22            break 
     23        else: 
     24            runningNodebooter = 0 
     25#    runningNodebooter = 'dev/nodes/' in processes 
     26    return runningNodebooter 
     27 
     28def startNodebooter(request, ip, port, user, password): 
     29    client = connect(request, ip, port, user, password) 
     30    stdin, stdout, stderr = client.exec_command('cd /sdr; nodeBooter -D -d dev/nodes/default_GPP_node/DeviceManager.dcd.xml') 
    1731    return render_to_response('DomainMan/console.html', locals(), context_instance=RequestContext(request)) 
     32 
     33def stopNodebooter(request, ip, port, user, password): 
     34    client = connect(request, ip, port, user, password) 
     35    stdin, stdout, stderr = client.exec_command('killall nodeBooter') 
     36    return render_to_response('DomainMan/console.html', locals(), context_instance=RequestContext(request)) 
     37 
     38def nodeBooter_page(request, ip, port, user, password): 
     39    client = connect(request, ip, port, user, password) 
     40    if not nodeBooter_running(client): 
     41        stdin, stdout, stderr = client.exec_command('cd /sdr; nodeBooter -D -d dev/nodes/default_GPP_node/DeviceManager.dcd.xml') 
     42    runningNodebooter = nodeBooter_running(client) 
     43    return render_to_response('DomainMan/console.html', locals(), context_instance=RequestContext(request)) 
     44 
     45 
     46