Example #1
0
def _createParser():
    parser = OptionParser(domain="flumotion-rrdmon")

    group = OptionGroup(parser, "rrdmon")
    group.add_option('-s', '--service-name',
                     action="store", type="string", dest="serviceName",
                     help="name to use for log and pid files "
                          "when run as a daemon")
    group.add_option('-D', '--daemonize',
                     action="store_true", dest="daemonize",
                     help="run in background as a daemon")
    group.add_option('', '--daemonize-to',
                     action="store", dest="daemonizeTo",
                     help="what directory to run from when daemonizing")

    parser.add_option('-L', '--logdir',
                      action="store", dest="logdir",
                      help="flumotion log directory (default: %s)" %
                        configure.logdir)
    parser.add_option('-R', '--rundir',
                      action="store", dest="rundir",
                      help="flumotion run directory (default: %s)" %
                        configure.rundir)
    parser.add_option_group(group)

    return parser
Example #2
0
    def testGroup(self):
        parser = OptionParser()

        group = OptionGroup(parser, "group")
        group.add_option('-t', '--test', action="store_true", dest="test")

        parser.add_option_group(group)

        options, rest = parser.parse_args([])
        self.failIf(options.test)
        self.failIf(rest)

        options, rest = parser.parse_args(['--test'])
        self.failUnless(options.test)
        self.failIf(rest)

        options, rest = parser.parse_args(['--test', '--verbose', 'rest'])
        self.failUnless(options.test)
        self.failUnless(options.verbose)
        self.assertEqual(rest, ["rest"])
Example #3
0
    def testGroup(self):
        parser = OptionParser()

        group = OptionGroup(parser, "group")
        group.add_option('-t', '--test', action="store_true", dest="test")

        parser.add_option_group(group)


        options, rest = parser.parse_args([])
        self.failIf(options.test)
        self.failIf(rest)

        options, rest = parser.parse_args(['--test'])
        self.failUnless(options.test)
        self.failIf(rest)

        options, rest = parser.parse_args(['--test', '--verbose', 'rest'])
        self.failUnless(options.test)
        self.failUnless(options.verbose)
        self.assertEqual(rest, ["rest"])
Example #4
0
def _createParser():
    usagemessage = "usage: %prog [options] manager.xml flow1.xml [...]"
    desc = "The manager is the core component of the Flumotion streaming\
 server. It takes its configuration from one or more planet configuration\
 files. The first file is mandatory, and contains base configuration \
 information for the manager. Zero or more additional configuration files\
 can be provided, these are used to configure flows that the manager should\
 run on available workers."

    parser = OptionParser(usage=usagemessage, description=desc, domain="flumotion-manager")

    group = OptionGroup(parser, "manager options")
    group.add_option("-H", "--hostname", action="store", type="string", dest="host", help="hostname to listen as")
    group.add_option(
        "-P",
        "--port",
        action="store",
        type="int",
        dest="port",
        default=None,
        help="port to listen on [default %d (ssl) or %d (tcp)]" % (defaultSSLPort, defaultTCPPort),
    )
    group.add_option(
        "-T",
        "--transport",
        action="store",
        type="string",
        dest="transport",
        help="transport protocol to use (tcp/ssl) [default ssl]",
    )
    group.add_option(
        "-C",
        "--certificate",
        action="store",
        type="string",
        dest="certificate",
        default=None,
        help="PEM certificate file (for SSL) " "[default default.pem]",
    )
    group.add_option("-n", "--name", action="store", type="string", dest="name", help="manager name")
    group.add_option(
        "-s",
        "--service-name",
        action="store",
        type="string",
        dest="serviceName",
        help="name to use for log and pid files " "when run as a daemon",
    )
    group.add_option(
        "-D", "--daemonize", action="store_true", dest="daemonize", default=False, help="run in background as a daemon"
    )
    group.add_option(
        "", "--daemonize-to", action="store", dest="daemonizeTo", help="what directory to run from when daemonizing"
    )

    parser.add_option(
        "-L", "--logdir", action="store", dest="logdir", help="flumotion log directory (default: %s)" % configure.logdir
    )
    parser.add_option(
        "-R", "--rundir", action="store", dest="rundir", help="flumotion run directory (default: %s)" % configure.rundir
    )

    parser.add_option_group(group)

    return parser
Example #5
0
def _createParser():
    parser = OptionParser(domain="flumotion-worker")

    group = OptionGroup(parser, "worker options")
    group.add_option('-H', '--host',
                     action="store", type="string", dest="host",
                     help="manager host to connect to [default localhost]")
    group.add_option('-P', '--port',
                     action="store", type="int", dest="port",
                     help="manager port to connect to " \
                        "[default %d (ssl) or %d (tcp)]" % (
                        configure.defaultSSLManagerPort,
                        configure.defaultTCPManagerPort))
    group.add_option('-T', '--transport',
                     action="store", type="string", dest="transport",
                     help="transport protocol to use (tcp/ssl) [default ssl]")
    group.add_option('-n', '--name',
                     action="store", type="string", dest="name",
                     help="worker name to use in the manager")
    group.add_option('-s', '--service-name',
                     action="store", type="string", dest="serviceName",
                     help="name to use for log and pid files "
                          "when run as a daemon")
    group.add_option('-D', '--daemonize',
                     action="store_true", dest="daemonize",
                     help="run in background as a daemon")
    group.add_option('', '--daemonize-to',
                     action="store", dest="daemonizeTo",
                     help="what directory to run from when daemonizing")

    parser.add_option('-L', '--logdir',
                      action="store", dest="logdir",
                      help="flumotion log directory (default: %s)" %
                        configure.logdir)
    parser.add_option('-R', '--rundir',
                      action="store", dest="rundir",
                      help="flumotion run directory (default: %s)" %
                        configure.rundir)

    group.add_option('-u', '--username',
                     action="store", type="string", dest="username",
                     default="",
                     help="username to use")
    group.add_option('-p', '--password',
                     action="store", type="string", dest="password",
                     default="",
                     help="password to use")

    group.add_option('-F', '--feederports',
                     action="store", type="string", dest="feederports",
                     help="range of feeder ports to use")
    group.add_option('', '--random-feederports',
                     action="store_true",
                     dest="randomFeederports",
                     help="Use randomly available feeder ports")

    parser.add_option_group(group)

    return parser
Example #6
0
def _createParser():
    usagemessage = "usage: %prog [options] manager.xml flow1.xml [...]"
    desc = "The manager is the core component of the Flumotion streaming\
 server. It takes its configuration from one or more planet configuration\
 files. The first file is mandatory, and contains base configuration \
 information for the manager. Zero or more additional configuration files\
 can be provided, these are used to configure flows that the manager should\
 run on available workers."

    parser = OptionParser(usage=usagemessage, description=desc,
                          domain="flumotion-manager")

    group = OptionGroup(parser, "manager options")
    group.add_option('-H', '--hostname',
                     action="store", type="string", dest="host",
                     help="hostname to listen as")
    group.add_option('-P', '--port',
                     action="store", type="int", dest="port",
                     default=None,
                     help="port to listen on [default %d (ssl) or %d (tcp)]" %
                     (defaultSSLPort, defaultTCPPort))
    group.add_option('-T', '--transport',
                     action="store", type="string", dest="transport",
                     help="transport protocol to use (tcp/ssl) [default ssl]")
    group.add_option('-C', '--certificate',
                     action="store", type="string", dest="certificate",
                     default=None,
                     help="PEM certificate file (for SSL) "
                     "[default default.pem]")
    group.add_option('-n', '--name',
                     action="store", type="string", dest="name",
                     help="manager name")
    group.add_option('-s', '--service-name',
                     action="store", type="string", dest="serviceName",
                     help="name to use for log and pid files "
                          "when run as a daemon")
    group.add_option('-D', '--daemonize',
                     action="store_true", dest="daemonize",
                     default=False,
                     help="run in background as a daemon")
    group.add_option('', '--daemonize-to',
                     action="store", dest="daemonizeTo",
                     help="what directory to run from when daemonizing")

    parser.add_option('-L', '--logdir',
                      action="store", dest="logdir",
                      help="flumotion log directory (default: %s)" %
                        configure.logdir)
    parser.add_option('-R', '--rundir',
                      action="store", dest="rundir",
                      help="flumotion run directory (default: %s)" %
                        configure.rundir)

    parser.add_option_group(group)

    return parser
Example #7
0
def _createParser():
    parser = OptionParser(domain="flumotion-worker")

    group = OptionGroup(parser, "worker options")
    group.add_option('-H', '--host',
                     action="store", type="string", dest="host",
                     help="manager host to connect to [default localhost]")
    group.add_option('-P', '--port',
                     action="store", type="int", dest="port",
                     help="manager port to connect to " \
                        "[default %d (ssl) or %d (tcp)]" % (
                        configure.defaultSSLManagerPort,
                        configure.defaultTCPManagerPort))
    group.add_option('-T', '--transport',
                     action="store", type="string", dest="transport",
                     help="transport protocol to use (tcp/ssl) [default ssl]")
    group.add_option('-n', '--name',
                     action="store", type="string", dest="name",
                     help="worker name to use in the manager")
    group.add_option('-s', '--service-name',
                     action="store", type="string", dest="serviceName",
                     help="name to use for log and pid files "
                          "when run as a daemon")
    group.add_option('-D', '--daemonize',
                     action="store_true", dest="daemonize",
                     help="run in background as a daemon")
    group.add_option('', '--daemonize-to',
                     action="store", dest="daemonizeTo",
                     help="what directory to run from when daemonizing")

    parser.add_option('-L', '--logdir',
                      action="store", dest="logdir",
                      help="flumotion log directory (default: %s)" %
                        configure.logdir)
    parser.add_option('-R', '--rundir',
                      action="store", dest="rundir",
                      help="flumotion run directory (default: %s)" %
                        configure.rundir)

    group.add_option('-u', '--username',
                     action="store", type="string", dest="username",
                     default="",
                     help="username to use")
    group.add_option('-p', '--password',
                     action="store", type="string", dest="password",
                     default="",
                     help="password to use")

    group.add_option('-F', '--feederports',
                     action="store", type="string", dest="feederports",
                     help="range of feeder ports to use")
    group.add_option('', '--random-feederports',
                     action="store_true",
                     dest="randomFeederports",
                     help="Use randomly available feeder ports")

    parser.add_option_group(group)

    return parser