reset.py
Go to the documentation of this file.
00001 #! /usr/bin/env python
00002 
00003 """
00004 usage: %(progname)s [args]
00005 """
00006 
00007 import nstart
00008 import config
00009 
00010 import os, sys, string, time, getopt, re
00011 import subprocess
00012 from pyclearsilver.log import *
00013 
00014 import neo_cgi, neo_util, neo_cs
00015 
00016 from pyclearsilver import CSPage
00017 from pyclearsilver import odb
00018 
00019 import MBPage
00020 import db_webui
00021 
00022 import webutil
00023 
00024 
00025 class MyPage(MBPage.MBPage):
00026   def setup(self, hdf):
00027     pass
00028     
00029   def display(self, hdf):
00030     webutil.grabTopics(hdf, [])
00031     
00032   def Action_DoReset(self, hdf):
00033     # do rosreset here -- rosreset init script, webui init script
00034     warn("calling robot reset")
00035     proc = subprocess.Popen(["sudo", "robot", "reset", "--force", "-u", self.username], stdout=subprocess.PIPE)
00036     out, err = proc.communicate()
00037     if out:
00038       warn("out: " + out)
00039     if err:
00040       warn("err: " + err)
00041     
00042     time.sleep(5)    
00043     warn("starting webui")
00044         
00045     self.redirectUri(config.gBaseURL + "webui/reset.py")
00046 
00047   def Action_AjaxReset(self, hdf):
00048     # do rosreset here -- rosreset init script, webui init script
00049     warn("calling ajax robot reset")
00050     proc = subprocess.Popen(["sudo", "robot", "reset", "--force", "-u", self.username], stdout=subprocess.PIPE)
00051     out, err = proc.communicate()
00052     if out:
00053       warn("out: " + out)
00054     if err:
00055       warn("err: " + err)
00056 
00057     time.sleep(10)    
00058     warn("starting webui")
00059 
00060     hdf.setValue("CGI.result", "OK")
00061 
00062     hdf.setValue("Content", "ajax_result.cs")
00063 
00064 
00065 def run(context):
00066   return MyPage(context, pagename="reset", nologin=False)
00067 
00068 def main():
00069   context = CSPage.Context()
00070   run(context).start()
00071 
00072 if __name__ == "__main__":
00073   main()
00074 


webui
Author(s): Scott Hassan/hassan@willowgarage.com
autogenerated on Wed Apr 23 2014 10:36:00