Ejemplo n.º 1
0
    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",
                        default=24, metavar="DEPTH",
                        help="Set the bit depth to use for the server. (linux only)") )

    app.Initialize("VenueVNCServer")
    log = app.GetLog()

    # Log options in debug mode
    if app.GetOption('debug'):
        log.info("Options:")
        for opt in ['venueUrl','name','vncserverexe','display','geometry','depth']:
            log.info('  %s = %s' % (opt,str(app.GetOption(opt))))
    
    # Verify venue url option
    if not app.GetOption('venueUrl'):
        msg = "VenueURL must be specified; exiting." 
        print msg
        log.info(msg)
        sys.exit(1)
    
    # Use the vnc executable specified on the command line, or...
Ejemplo n.º 2
0
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)