def main(): app = CmdlineApplication() portOption = Option("-p", "--port", type="int", dest="port", default=defaultPort, metavar="PORT", help="Set the port the RegistryPeer will use") app.AddCmdLineOption(portOption) urlOption = Option( "-u", "--peerListUrl", type="string", dest="peerListUrl", default=defaultPeerListUrl, metavar="URL", help= "The url to bootstrap the system. For the current design, this is a complete list of peers." ) app.AddCmdLineOption(urlOption) try: args = app.Initialize("RegistryPeer") except Exception, e: print "Toolkit Initialization failed, exiting." print " Initialization Error: ", e sys.exit(-1)
def main(): """ The main routine. """ # Instantiate the app app = CmdlineApplication() # Handle command-line arguments urlOption = Option("-u", "--url", dest="url", default=0, help="URL for the venue server to manage.") app.AddCmdLineOption(urlOption) # Initialize the application try: app.Initialize("VenueMgmt") except Exception, e: print "Exception: ", e sys.exit(0)
[description] url = <url> There may be more information in the file, but this is the only information used by this program and so anything else is extraneous. """ # Initialize app = CmdlineApplication() urlOption = Option("-u", "--url", dest="url", default=None, help="Specify a venue url on the command line.") app.AddCmdLineOption(urlOption) fileOption = Option("-f", "--file", dest="file", default=None, help="Specify a file that contains a venue url.") app.AddCmdLineOption(fileOption) args = app.Initialize() venueUrl = app.GetOption("url") fileName = app.GetOption("file") print "URL: ", venueUrl print "FILE: ", fileName """
from optparse import Option from AccessGrid.Toolkit import CmdlineApplication from AccessGrid.interfaces.VenueServer_client import VenueServerIW from AccessGrid.ClientProfile import ClientProfile m2threading.init() verbose =1 random.seed(time.time()) app = CmdlineApplication() urlOption = Option("-u", "--url", dest="url", default="https://localhost/VenueServer", help="URL to the venue server to test.") app.AddCmdLineOption(urlOption) nvcOption = Option("-n", "--num-clients", dest="nc", type="int", default=1, help="number of clients to use.") app.AddCmdLineOption(nvcOption) rtOption = Option("-t", "--traverse", dest="rt", type="int", default=10, help="number of venues each client will traverse.") app.AddCmdLineOption(rtOption) try: app.Initialize("ClientSwarm") except: print "Application initialize failed, exiting." sys.exit(-1)
#!/usr/bin/python # import sys from optparse import Option from AccessGrid.Toolkit import CmdlineApplication from AccessGrid.VenueServer import VenueServerIW app = CmdlineApplication() urlOption = Option("-u", "--url", dest="url", default=None, help="URL to the server you want to shut down.") app.AddCmdLineOption(urlOption) try: args = app.Initialize("StopServer") except Exception, e: print "Exception initializing toolkit:", e sys.exit(-1) url = app.GetOption("url") server = VenueServerIW(url) server.Shutdown(0)
def shutdown(self): log.debug('VNCServerAppObject.shutdown') # Stop while loop self.running = 0 # Stop and cleanup vnc server self.vncServer.destroy() # Stop application service and remove from venue. self.venueProxy.DestroyApplication(self.appDescription.id) if __name__ == "__main__": app = CmdlineApplication().instance() app.AddCmdLineOption( Option("-v", "--venueUrl", type="string", dest="venueUrl", default=None, metavar="VENUE_URL", help="Set the venue in which the VenueVNC application should be started.") ) app.AddCmdLineOption( Option("-n", "--name", type="string", dest="name", default=None, metavar="NAME", help="Set the name by which the server will be identified in the venue.") ) app.AddCmdLineOption( Option("--vncserverexe", type="string", dest="vncserverexe", default=None, metavar="VNC_SERVER_EXE", help="Set the VNC server executable to use") ) app.AddCmdLineOption( Option("--display", type="string", dest="display", default=":9", metavar="DISPLAY", help="Set the display the VNC server should run on. (linux only)") ) app.AddCmdLineOption( Option("-g", "--geometry", type="string", dest="geometry", default="1024x768", metavar="GEOMETRY", help="Set the geometry of the VNC server. (linux only)") ) app.AddCmdLineOption( Option("--depth", type="int", dest="depth",
def main(): """ The main routine. """ # Instantiate the app app = CmdlineApplication() caOption = Option( "-C", "--ca", action="store_true", dest="is_ca_mode", default=0, help="Use CA mode for this invocation of the certificate manager.") idOption = Option( "-I", "--id", action="store_false", dest="is_ca_mode", default=0, help="Use ID mode for this invocation of the certificate manager.") forceOption = Option("-f", "--force", action="store_true", dest="force_overwrite", default=0, help="Overwrite existing files.") app.AddCmdLineOption(caOption) app.AddCmdLineOption(idOption) app.AddCmdLineOption(forceOption) try: args = app.Initialize("CertificateManager") except Exception: sys.exit(0) cmd = CertMgrCmdProcessor(app.GetCertificateManager(), app.GetLog()) # # If no args were passed, start up the command-driver # cert mgr. # if app.GetOption("is_ca_mode"): cmd.setCAMode() if len(args) == 0: cmd.cmdloop() else: # # Otherwise, process a single command from teh command line. # cmd.setInteractive(0) cmd.setForceOverwrite(app.GetOption("force_overwrite")) mycmd = args[0] + " " + " ".join(map(lambda a: '"' + a + '"', args[1:])) print mycmd cmd.onecmd(mycmd)